mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-03-25 17:40:27 +08:00
moved functions out of m4 into c files in libdispatch/netcdf.m4
This commit is contained in:
commit
bb57cf2e4b
@ -3,7 +3,7 @@ Entries are in reverse chronological order (most recent first).
|
||||
|
||||
VERSION COMMENTS
|
||||
------- --------
|
||||
4.2 2010-04-10
|
||||
4.1.2 2010-06-20
|
||||
|
||||
Modified constraint parser to be more compatible with
|
||||
a java version of the parser.
|
||||
@ -11,6 +11,10 @@ VERSION COMMENTS
|
||||
Modified ncgen to utilize iterators internally; should be
|
||||
no user visible effect.
|
||||
|
||||
Fixed two large-file bugs with using classic format or
|
||||
64-bit offset format and accessing multidimensional
|
||||
variables with more than 2**32 values.
|
||||
|
||||
4.1.1 2010-04-01
|
||||
|
||||
Fixed various build issues.
|
||||
|
@ -1416,6 +1416,7 @@ AC_SUBST(HAS_DAP,[$enable_dap])
|
||||
AC_SUBST(HAS_NC2,[$nc_build_v2])
|
||||
AC_SUBST(HAS_NC4,[$enable_netcdf_4])
|
||||
AC_SUBST(HAS_HDF4,[$enable_hdf4])
|
||||
AC_SUBST(HAS_PNETCDF,[$enable_pnetcdf])
|
||||
AC_SUBST(HAS_HDF5,[$enable_netcdf_4])
|
||||
AC_SUBST(HAS_F77,[$nc_build_f77])
|
||||
AC_SUBST(HAS_F90,[$nc_build_f90])
|
||||
@ -1449,6 +1450,13 @@ if test "x$enable_netcdf_4" = xyes ; then
|
||||
fi
|
||||
EXTERN_LDFLAGS="${EXTERN_LDFLAGS} -lmfhdf -ldf"
|
||||
fi
|
||||
if test "x$enable_pnetcdf" = xyes; then
|
||||
if test "x$PNETCDFDIR" != x ; then
|
||||
EXTERN_LDFLAGS="${EXTERN_LDFLAGS} -L$PNETCDFDIR/lib"
|
||||
EXTERN_CFLAGS="${EXTERN_CFLAGS} -I$PNETCDFDIR/include"
|
||||
fi
|
||||
EXTERN_LDFLAGS="${EXTERN_LDFLAGS} -lpnetcdf"
|
||||
fi
|
||||
fi # netcdf-4
|
||||
# Do zlib and szlib if either dap or netcdf4 is enabled
|
||||
if test "x$enable_netcdf_4" = xyes -o "x$enable_dap" = xyes ; then
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
# We will need to find the C++ header files.
|
||||
AM_CXXFLAGS = -I$(top_srcdir)/cxx4
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/cxx4
|
||||
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cxx4
|
||||
AM_LDFLAGS=
|
||||
|
||||
AM_CPPFLAGS += -I$(top_builddir)/liblib
|
||||
|
@ -16,7 +16,7 @@ AM_LDFLAGS =
|
||||
# Tell the compiler where to find the .mod files. The .mod file is
|
||||
# built, and therefore found in the build directory, not the source
|
||||
# directory.
|
||||
AM_FCFLAGS += -I$(top_srcdir)/fortran -I$(top_builddir)/f90 @MOD_FLAG@$(top_builddir)/f90
|
||||
AM_FCFLAGS += -I$(top_srcdir) -I$(top_srcdir)/fortran -I$(top_builddir)/f90 @MOD_FLAG@$(top_builddir)/f90
|
||||
AM_FFLAGS += ${AM_FCFLAGS}
|
||||
|
||||
if BUILD_SEPARATE_FORTRAN
|
||||
|
@ -26,9 +26,9 @@ libnetcdff90_la_SOURCES = typeSizes.f90
|
||||
# The file netcdf.f90 includes all of these.
|
||||
libnetcdff90_la_DEPENDENCIES = netcdf_attributes.f90 \
|
||||
netcdf_constants.f90 netcdf_dims.f90 netcdf_expanded.f90 \
|
||||
netcdf_externals.f90 netcdf_file.f90 netcdf3_file.f90 netcdf4_file.f90 \
|
||||
netcdf_overloads.f90 netcdf_text_variables.f90 netcdf_variables.f90 \
|
||||
netcdf_visibility.f90 netcdf_eightbyte.f90
|
||||
netcdf_externals.f90 netcdf_file.f90 netcdf_overloads.f90 \
|
||||
netcdf_text_variables.f90 netcdf_variables.f90 netcdf_visibility.f90 \
|
||||
netcdf_eightbyte.f90
|
||||
|
||||
# Is the user building netCDF-4?
|
||||
if USE_NETCDF4
|
||||
@ -39,15 +39,15 @@ libnetcdff90_la_SOURCES += netcdf4.f90
|
||||
# These are the extra netCDF-4 F90 source files.
|
||||
libnetcdff90_la_DEPENDENCIES += netcdf4_func.f90 netcdf4_externals.f90 \
|
||||
netcdf4_visibility.f90 netcdf4_constants.f90 netcdf4.f90 \
|
||||
netcdf4_eightbyte.f90 netcdf4_variables.f90
|
||||
netcdf4_eightbyte.f90 netcdf4_variables.f90 netcdf4_file.f90
|
||||
|
||||
NETCDF_O = netcdf4.o
|
||||
|
||||
else # not USE_NETCDF4
|
||||
|
||||
# Use netcdf.f90 to get the library.
|
||||
libnetcdff90_la_SOURCES += netcdf.f90
|
||||
libnetcdff90_la_DEPENDENCIES += netcdf.f90
|
||||
libnetcdff90_la_SOURCES += netcdf.f90
|
||||
libnetcdff90_la_DEPENDENCIES += netcdf.f90 netcdf3_file.f90
|
||||
|
||||
NETCDF_O = netcdf.o
|
||||
|
||||
|
@ -1,37 +1,43 @@
|
||||
! -------
|
||||
function nf90_open(path, mode, ncid, chunksize)
|
||||
character (len = *), intent(in ) :: path
|
||||
integer, intent(in ) :: mode
|
||||
integer, intent( out) :: ncid
|
||||
integer, optional, intent(inout) :: chunksize
|
||||
integer :: nf90_open
|
||||
! This is part of the netCDF F90 API, or. Copyright 2006 UCAR. See COPYRIGHT file
|
||||
! for details.
|
||||
|
||||
if(present(chunksize)) then
|
||||
nf90_open = nf__open(path, mode, chunksize, ncid)
|
||||
else
|
||||
nf90_open = nf_open(path, mode, ncid)
|
||||
end if
|
||||
end function nf90_open
|
||||
! -------
|
||||
function nf90_create(path, cmode, ncid, initialsize, chunksize)
|
||||
character (len = *), intent(in ) :: path
|
||||
integer, intent(in ) :: cmode
|
||||
integer, intent( out) :: ncid
|
||||
integer, optional, intent(in ) :: initialsize
|
||||
integer, optional, intent(inout) :: chunksize
|
||||
integer :: nf90_create
|
||||
|
||||
integer :: fileSize, chunk
|
||||
|
||||
if(.not. (present(initialsize) .or. present(chunksize)) ) then
|
||||
nf90_create = nf_create(path, cmode, ncid)
|
||||
else
|
||||
! Default values per man page
|
||||
filesize = 0; chunk = nf90_sizehint_default
|
||||
if(present(initialsize)) filesize = initialsize
|
||||
if(present(chunksize )) chunk = chunksize
|
||||
nf90_create = nf__create(path, cmode, filesize, chunk, ncid)
|
||||
! Pass back the value actually used
|
||||
if(present(chunksize )) chunksize = chunk
|
||||
end if
|
||||
end function nf90_create
|
||||
! This file contains the netcdf-3 file open and create functions.
|
||||
|
||||
! $Id: netcdf4_constants.f90,v 1.14 2010/05/25 13:53:00 ed Exp $
|
||||
! -------
|
||||
function nf90_open(path, mode, ncid, chunksize)
|
||||
character (len = *), intent(in ) :: path
|
||||
integer, intent(in ) :: mode
|
||||
integer, intent( out) :: ncid
|
||||
integer, optional, intent(inout) :: chunksize
|
||||
integer :: nf90_open
|
||||
|
||||
if(present(chunksize)) then
|
||||
nf90_open = nf__open(path, mode, chunksize, ncid)
|
||||
else
|
||||
nf90_open = nf_open(path, mode, ncid)
|
||||
end if
|
||||
end function nf90_open
|
||||
! -------
|
||||
function nf90_create(path, cmode, ncid, initialsize, chunksize)
|
||||
character (len = *), intent(in ) :: path
|
||||
integer, intent(in ) :: cmode
|
||||
integer, intent( out) :: ncid
|
||||
integer, optional, intent(in ) :: initialsize
|
||||
integer, optional, intent(inout) :: chunksize
|
||||
integer :: nf90_create
|
||||
|
||||
integer :: fileSize, chunk
|
||||
|
||||
if(.not. (present(initialsize) .or. present(chunksize)) ) then
|
||||
nf90_create = nf_create(path, cmode, ncid)
|
||||
else
|
||||
! Default values per man page
|
||||
filesize = 0; chunk = nf90_sizehint_default
|
||||
if(present(initialsize)) filesize = initialsize
|
||||
if(present(chunksize )) chunk = chunksize
|
||||
nf90_create = nf__create(path, cmode, filesize, chunk, ncid)
|
||||
! Pass back the value actually used
|
||||
if(present(chunksize )) chunksize = chunk
|
||||
end if
|
||||
end function nf90_create
|
||||
|
@ -1,4 +1,5 @@
|
||||
! This is part of netCDF-4. Copyright 2006 UCAR. See COPYRIGHT file for details.
|
||||
! This is part of netCDF-4. Copyright 2006 UCAR. See COPYRIGHT file
|
||||
! for details.
|
||||
|
||||
! This file contains the extra F90 constants needed for netCDF-4.
|
||||
|
||||
|
@ -1,149 +1,155 @@
|
||||
! -------
|
||||
function nf90_open(path, mode, ncid, chunksize, cache_size, cache_nelems, &
|
||||
cache_preemption, comm, info)
|
||||
implicit none
|
||||
character (len = *), intent(in) :: path
|
||||
integer, intent(in) :: mode
|
||||
integer, intent(out) :: ncid
|
||||
integer, optional, intent(inout) :: chunksize
|
||||
integer, optional, intent(in) :: cache_size, cache_nelems
|
||||
real, optional, intent(in) :: cache_preemption
|
||||
integer, optional, intent(in) :: comm, info
|
||||
integer :: size_in, nelems_in, preemption_in
|
||||
integer :: size_out, nelems_out, preemption_out, ret
|
||||
integer :: nf90_open
|
||||
! This is part of netCDF-4. Copyright 2006 UCAR. See COPYRIGHT file
|
||||
! for details.
|
||||
|
||||
! If using parallel, both comm and info must be provided.
|
||||
if (present(comm) .and. .not. present(info)) then
|
||||
nf90_open = NF90_EINVAL;
|
||||
return
|
||||
end if
|
||||
|
||||
! If the user specified chuck cache parameters, use them. But user
|
||||
! may have specified one, two, or three settings. Leave the others
|
||||
! unchanged.
|
||||
if (present(cache_size) .or. present(cache_nelems) .or. &
|
||||
present(cache_preemption)) then
|
||||
ret = nf_get_chunk_cache(size_in, nelems_in, preemption_in)
|
||||
if (ret .ne. nf90_noerr) then
|
||||
nf90_open = ret
|
||||
return
|
||||
end if
|
||||
if (present(cache_size)) then
|
||||
size_out = cache_size
|
||||
else
|
||||
size_out = size_in
|
||||
end if
|
||||
if (present(cache_nelems)) then
|
||||
nelems_out = cache_nelems
|
||||
else
|
||||
nelems_out = nelems_in
|
||||
end if
|
||||
if (present(cache_preemption)) then
|
||||
preemption_out = cache_preemption
|
||||
else
|
||||
preemption_out = preemption_in
|
||||
end if
|
||||
nf90_open = nf_set_chunk_cache(size_out, nelems_out, preemption_out)
|
||||
if (nf90_open .ne. nf90_noerr) return
|
||||
end if
|
||||
! This file contains the netcdf-4 file open and create functions.
|
||||
|
||||
! Do the open.
|
||||
if(present(chunksize)) then
|
||||
nf90_open = nf__open(path, mode, chunksize, ncid)
|
||||
else
|
||||
if (present(comm)) then
|
||||
nf90_open = nf_open_par(path, mode, comm, info, ncid)
|
||||
else
|
||||
nf90_open = nf_open(path, mode, ncid)
|
||||
end if
|
||||
end if
|
||||
if (nf90_open .ne. nf90_noerr) return
|
||||
! $Id: netcdf4_constants.f90,v 1.14 2010/05/25 13:53:00 ed Exp $
|
||||
! -------
|
||||
function nf90_open(path, mode, ncid, chunksize, cache_size, cache_nelems, &
|
||||
cache_preemption, comm, info)
|
||||
implicit none
|
||||
character (len = *), intent(in) :: path
|
||||
integer, intent(in) :: mode
|
||||
integer, intent(out) :: ncid
|
||||
integer, optional, intent(inout) :: chunksize
|
||||
integer, optional, intent(in) :: cache_size, cache_nelems
|
||||
real, optional, intent(in) :: cache_preemption
|
||||
integer, optional, intent(in) :: comm, info
|
||||
integer :: size_in, nelems_in, preemption_in
|
||||
integer :: size_out, nelems_out, preemption_out, ret
|
||||
integer :: nf90_open
|
||||
|
||||
! If settings were changed, reset chunk chache to original settings.
|
||||
if (present(cache_size) .or. present(cache_nelems) .or. &
|
||||
present(cache_preemption)) then
|
||||
nf90_open = nf_set_chunk_cache(size_in, nelems_in, preemption_in)
|
||||
end if
|
||||
! If using parallel, both comm and info must be provided.
|
||||
if (present(comm) .and. .not. present(info)) then
|
||||
nf90_open = NF90_EINVAL;
|
||||
return
|
||||
end if
|
||||
|
||||
end function nf90_open
|
||||
! -------
|
||||
function nf90_create(path, cmode, ncid, initialsize, chunksize, cache_size, &
|
||||
cache_nelems, cache_preemption, comm, info)
|
||||
implicit none
|
||||
character (len = *), intent(in) :: path
|
||||
integer, intent(in) :: cmode
|
||||
integer, intent(out) :: ncid
|
||||
integer, optional, intent(in) :: initialsize
|
||||
integer, optional, intent(inout) :: chunksize
|
||||
integer, optional, intent(in) :: cache_size, cache_nelems
|
||||
integer, optional, intent(in) :: cache_preemption
|
||||
integer, optional, intent(in) :: comm, info
|
||||
integer :: size_in, nelems_in, preemption_in
|
||||
integer :: size_out, nelems_out, preemption_out, ret
|
||||
integer :: nf90_create
|
||||
integer :: fileSize, chunk
|
||||
integer :: x
|
||||
! If the user specified chuck cache parameters, use them. But user
|
||||
! may have specified one, two, or three settings. Leave the others
|
||||
! unchanged.
|
||||
if (present(cache_size) .or. present(cache_nelems) .or. &
|
||||
present(cache_preemption)) then
|
||||
ret = nf_get_chunk_cache(size_in, nelems_in, preemption_in)
|
||||
if (ret .ne. nf90_noerr) then
|
||||
nf90_open = ret
|
||||
return
|
||||
end if
|
||||
if (present(cache_size)) then
|
||||
size_out = cache_size
|
||||
else
|
||||
size_out = size_in
|
||||
end if
|
||||
if (present(cache_nelems)) then
|
||||
nelems_out = cache_nelems
|
||||
else
|
||||
nelems_out = nelems_in
|
||||
end if
|
||||
if (present(cache_preemption)) then
|
||||
preemption_out = cache_preemption
|
||||
else
|
||||
preemption_out = preemption_in
|
||||
end if
|
||||
nf90_open = nf_set_chunk_cache(size_out, nelems_out, preemption_out)
|
||||
if (nf90_open .ne. nf90_noerr) return
|
||||
end if
|
||||
|
||||
! Just ignore options netCDF-3 options for netCDF-4 files, or
|
||||
! netCDF-4 options, for netCDF-3 files, so that the same user code
|
||||
! can work for both cases.
|
||||
! Do the open.
|
||||
if(present(chunksize)) then
|
||||
nf90_open = nf__open(path, mode, chunksize, ncid)
|
||||
else
|
||||
if (present(comm)) then
|
||||
nf90_open = nf_open_par(path, mode, comm, info, ncid)
|
||||
else
|
||||
nf90_open = nf_open(path, mode, ncid)
|
||||
end if
|
||||
end if
|
||||
if (nf90_open .ne. nf90_noerr) return
|
||||
|
||||
! If using parallel, but comm and info must be provided.
|
||||
if (present(comm) .and. .not. present(info)) then
|
||||
nf90_create = NF90_EINVAL;
|
||||
return
|
||||
end if
|
||||
|
||||
! If the user specified chuck cache parameters, use them. But user
|
||||
! may have specified one, two, or three settings. Leave the others
|
||||
! unchanged.
|
||||
if (present(cache_size) .or. present(cache_nelems) .or. &
|
||||
present(cache_preemption)) then
|
||||
nf90_create = nf_get_chunk_cache(size_in, nelems_in, preemption_in)
|
||||
if (nf90_create .ne. nf90_noerr) return
|
||||
if (present(cache_size)) then
|
||||
size_out = cache_size
|
||||
else
|
||||
size_out = size_in
|
||||
end if
|
||||
if (present(cache_nelems)) then
|
||||
nelems_out = cache_nelems
|
||||
else
|
||||
nelems_out = nelems_in
|
||||
end if
|
||||
if (present(cache_preemption)) then
|
||||
preemption_out = cache_preemption
|
||||
else
|
||||
preemption_out = preemption_in
|
||||
end if
|
||||
nf90_create = nf_set_chunk_cache(size_out, nelems_out, preemption_out)
|
||||
if (nf90_create .ne. nf90_noerr) return
|
||||
end if
|
||||
! If settings were changed, reset chunk chache to original settings.
|
||||
if (present(cache_size) .or. present(cache_nelems) .or. &
|
||||
present(cache_preemption)) then
|
||||
nf90_open = nf_set_chunk_cache(size_in, nelems_in, preemption_in)
|
||||
end if
|
||||
|
||||
! Do the file create.
|
||||
if(.not. (present(initialsize) .or. present(chunksize)) ) then
|
||||
if (present(comm)) then
|
||||
nf90_create = nf_create_par(path, cmode, comm, info, ncid)
|
||||
else
|
||||
nf90_create = nf_create(path, cmode, ncid)
|
||||
end if
|
||||
else
|
||||
! Default values per man page
|
||||
filesize = 0; chunk = nf90_sizehint_default
|
||||
if(present(initialsize)) filesize = initialsize
|
||||
if(present(chunksize )) chunk = chunksize
|
||||
nf90_create = nf__create(path, cmode, filesize, chunk, ncid)
|
||||
! Pass back the value actually used
|
||||
if(present(chunksize )) chunksize = chunk
|
||||
end if
|
||||
if (nf90_create .ne. nf90_noerr) return
|
||||
end function nf90_open
|
||||
! -------
|
||||
function nf90_create(path, cmode, ncid, initialsize, chunksize, cache_size, &
|
||||
cache_nelems, cache_preemption, comm, info)
|
||||
implicit none
|
||||
character (len = *), intent(in) :: path
|
||||
integer, intent(in) :: cmode
|
||||
integer, intent(out) :: ncid
|
||||
integer, optional, intent(in) :: initialsize
|
||||
integer, optional, intent(inout) :: chunksize
|
||||
integer, optional, intent(in) :: cache_size, cache_nelems
|
||||
integer, optional, intent(in) :: cache_preemption
|
||||
integer, optional, intent(in) :: comm, info
|
||||
integer :: size_in, nelems_in, preemption_in
|
||||
integer :: size_out, nelems_out, preemption_out, ret
|
||||
integer :: nf90_create
|
||||
integer :: fileSize, chunk
|
||||
integer :: x
|
||||
|
||||
! If settings were changed, reset chunk chache to original settings.
|
||||
if (present(cache_size) .or. present(cache_nelems) .or. &
|
||||
present(cache_preemption)) then
|
||||
nf90_create = nf_set_chunk_cache(size_in, nelems_in, preemption_in)
|
||||
end if
|
||||
! Just ignore options netCDF-3 options for netCDF-4 files, or
|
||||
! netCDF-4 options, for netCDF-3 files, so that the same user code
|
||||
! can work for both cases.
|
||||
|
||||
! If using parallel, but comm and info must be provided.
|
||||
if (present(comm) .and. .not. present(info)) then
|
||||
nf90_create = NF90_EINVAL;
|
||||
return
|
||||
end if
|
||||
|
||||
! If the user specified chuck cache parameters, use them. But user
|
||||
! may have specified one, two, or three settings. Leave the others
|
||||
! unchanged.
|
||||
if (present(cache_size) .or. present(cache_nelems) .or. &
|
||||
present(cache_preemption)) then
|
||||
nf90_create = nf_get_chunk_cache(size_in, nelems_in, preemption_in)
|
||||
if (nf90_create .ne. nf90_noerr) return
|
||||
if (present(cache_size)) then
|
||||
size_out = cache_size
|
||||
else
|
||||
size_out = size_in
|
||||
end if
|
||||
if (present(cache_nelems)) then
|
||||
nelems_out = cache_nelems
|
||||
else
|
||||
nelems_out = nelems_in
|
||||
end if
|
||||
if (present(cache_preemption)) then
|
||||
preemption_out = cache_preemption
|
||||
else
|
||||
preemption_out = preemption_in
|
||||
end if
|
||||
nf90_create = nf_set_chunk_cache(size_out, nelems_out, preemption_out)
|
||||
if (nf90_create .ne. nf90_noerr) return
|
||||
end if
|
||||
|
||||
! Do the file create.
|
||||
if(.not. (present(initialsize) .or. present(chunksize)) ) then
|
||||
if (present(comm)) then
|
||||
nf90_create = nf_create_par(path, cmode, comm, info, ncid)
|
||||
else
|
||||
nf90_create = nf_create(path, cmode, ncid)
|
||||
end if
|
||||
else
|
||||
! Default values per man page
|
||||
filesize = 0; chunk = nf90_sizehint_default
|
||||
if(present(initialsize)) filesize = initialsize
|
||||
if(present(chunksize )) chunk = chunksize
|
||||
nf90_create = nf__create(path, cmode, filesize, chunk, ncid)
|
||||
! Pass back the value actually used
|
||||
if(present(chunksize )) chunksize = chunk
|
||||
end if
|
||||
if (nf90_create .ne. nf90_noerr) return
|
||||
|
||||
! If settings were changed, reset chunk chache to original settings.
|
||||
if (present(cache_size) .or. present(cache_nelems) .or. &
|
||||
present(cache_preemption)) then
|
||||
nf90_create = nf_set_chunk_cache(size_in, nelems_in, preemption_in)
|
||||
end if
|
||||
|
||||
|
||||
end function nf90_create
|
||||
end function nf90_create
|
||||
|
@ -1,137 +1,144 @@
|
||||
! -------
|
||||
function nf90_inq_libvers()
|
||||
character(len = 80) :: nf90_inq_libvers
|
||||
|
||||
nf90_inq_libvers = nf_inq_libvers()
|
||||
end function nf90_inq_libvers
|
||||
! -------
|
||||
function nf90_strerror(ncerr)
|
||||
integer, intent( in) :: ncerr
|
||||
character(len = 80) :: nf90_strerror
|
||||
|
||||
nf90_strerror = nf_strerror(ncerr)
|
||||
end function nf90_strerror
|
||||
! -------
|
||||
!
|
||||
! File level control routines:
|
||||
!
|
||||
function nf90_inq_base_pe(ncid, pe)
|
||||
integer, intent( in) :: ncid
|
||||
integer, intent(out) :: pe
|
||||
integer :: nf90_inq_base_pe
|
||||
! This is part of the netCDF F90 API, or. Copyright 2006 UCAR. See COPYRIGHT file
|
||||
! for details.
|
||||
|
||||
! This file contains the netcdf file functions that are shared by
|
||||
! netcdf-3 and netcdf-4.
|
||||
|
||||
! $Id: netcdf4_constants.f90,v 1.14 2010/05/25 13:53:00 ed Exp $
|
||||
! -------
|
||||
function nf90_inq_libvers()
|
||||
character(len = 80) :: nf90_inq_libvers
|
||||
|
||||
nf90_inq_libvers = nf_inq_libvers()
|
||||
end function nf90_inq_libvers
|
||||
! -------
|
||||
function nf90_strerror(ncerr)
|
||||
integer, intent( in) :: ncerr
|
||||
character(len = 80) :: nf90_strerror
|
||||
|
||||
nf90_strerror = nf_strerror(ncerr)
|
||||
end function nf90_strerror
|
||||
! -------
|
||||
!
|
||||
! File level control routines:
|
||||
!
|
||||
function nf90_inq_base_pe(ncid, pe)
|
||||
integer, intent( in) :: ncid
|
||||
integer, intent(out) :: pe
|
||||
integer :: nf90_inq_base_pe
|
||||
|
||||
nf90_inq_base_pe = nf_inq_base_pe(ncid, pe)
|
||||
end function nf90_inq_base_pe
|
||||
! -------
|
||||
function nf90_set_base_pe(ncid, pe)
|
||||
integer, intent( in) :: ncid, pe
|
||||
integer :: nf90_set_base_pe
|
||||
|
||||
nf90_set_base_pe = nf_set_base_pe(ncid, pe)
|
||||
end function nf90_set_base_pe
|
||||
! -------
|
||||
function nf90_create_mp(path, cmode, initalsz, basepe, chunksizehint, ncid)
|
||||
character (len = *), intent( in) :: path
|
||||
integer, intent( in) :: cmode, initalsz, basepe, chunksizehint
|
||||
integer, intent(out) :: ncid
|
||||
integer :: nf90_create_mp
|
||||
|
||||
nf90_create_mp = nf__create_mp(path, cmode, initalsz, basepe, chunksizehint, ncid)
|
||||
end function nf90_create_mp
|
||||
! -------
|
||||
function nf90_open_mp(path, mode, basepe, chunksizeint, ncid)
|
||||
character (len = *), intent( in) :: path
|
||||
integer, intent( in) :: mode, basepe, chunksizeint
|
||||
integer, intent(out) :: ncid
|
||||
integer :: nf90_open_mp
|
||||
|
||||
nf90_open_mp = nf__open_mp(path, mode, basepe, chunksizeint, ncid)
|
||||
end function nf90_open_mp
|
||||
! -------
|
||||
function nf90_set_fill(ncid, fillmode, old_mode)
|
||||
integer, intent( in) :: ncid, fillmode
|
||||
integer, intent(out) :: old_mode
|
||||
integer :: nf90_set_fill
|
||||
|
||||
nf90_set_fill = nf_set_fill(ncid, fillmode, old_mode)
|
||||
end function nf90_set_fill
|
||||
! -------
|
||||
function nf90_redef(ncid)
|
||||
integer, intent( in) :: ncid
|
||||
integer :: nf90_redef
|
||||
|
||||
nf90_redef = nf_redef(ncid)
|
||||
end function nf90_redef
|
||||
! -------
|
||||
function nf90_enddef(ncid, h_minfree, v_align, v_minfree, r_align)
|
||||
integer, intent( in) :: ncid
|
||||
integer, optional, intent( in) :: h_minfree, v_align, v_minfree, r_align
|
||||
integer :: nf90_enddef
|
||||
|
||||
integer :: hMinFree, VAlign, VMinFree, RAlign
|
||||
|
||||
if(.not. any( (/ present(h_minfree), present(v_align), &
|
||||
present(v_minfree), present(r_align) /) ) )then
|
||||
nf90_enddef = nf_enddef(ncid)
|
||||
else
|
||||
! Default values per the man page
|
||||
hMinFree = 0; VMinFree = 0
|
||||
VAlign = 4; RAlign = 4
|
||||
if(present(h_minfree)) HMinFree = h_minfree
|
||||
if(present(v_align )) VAlign = v_align
|
||||
if(present(v_minfree)) VMinFree = v_minfree
|
||||
if(present(r_align )) RAlign = r_align
|
||||
nf90_enddef = nf__enddef(ncid, hMinFree, VAlign, VMinFree, RAlign)
|
||||
end if
|
||||
end function nf90_enddef
|
||||
! -------
|
||||
function nf90_sync(ncid)
|
||||
integer, intent( in) :: ncid
|
||||
integer :: nf90_sync
|
||||
|
||||
nf90_sync = nf_sync(ncid)
|
||||
end function nf90_sync
|
||||
! -------
|
||||
function nf90_abort(ncid)
|
||||
integer, intent( in) :: ncid
|
||||
integer :: nf90_abort
|
||||
|
||||
nf90_abort = nf_abort(ncid)
|
||||
end function nf90_abort
|
||||
! -------
|
||||
function nf90_close(ncid)
|
||||
integer, intent( in) :: ncid
|
||||
integer :: nf90_close
|
||||
|
||||
nf90_close = nf_close(ncid)
|
||||
end function nf90_close
|
||||
! -------
|
||||
function nf90_delete(name)
|
||||
character(len = *), intent( in) :: name
|
||||
integer :: nf90_delete
|
||||
|
||||
nf90_delete = nf_delete(name)
|
||||
end function nf90_delete
|
||||
|
||||
!
|
||||
! A single file level inquiry routine
|
||||
!
|
||||
function nf90_inquire(ncid, nDimensions, nVariables, nAttributes, unlimitedDimId, formatNum)
|
||||
integer, intent( in) :: ncid
|
||||
integer, optional, intent(out) :: nDimensions, nVariables, nAttributes, unlimitedDimId, formatNum
|
||||
integer :: nf90_inquire
|
||||
|
||||
integer :: nDims, nVars, nGAtts, unlimDimId, frmt
|
||||
|
||||
nf90_inquire = nf_inq(ncid, nDims, nVars, nGAtts, unlimDimId)
|
||||
if(present(nDimensions)) nDimensions = nDims
|
||||
if(present(nVariables)) nVariables = nVars
|
||||
if(present(nAttributes)) nAttributes = nGAtts
|
||||
if(present(unlimitedDimId)) unlimitedDimId = unlimDimId
|
||||
if(present(formatNum)) then
|
||||
nf90_inquire = nf_inq_format(ncid, frmt)
|
||||
formatNum = frmt
|
||||
endif
|
||||
end function nf90_inquire
|
||||
|
||||
nf90_inq_base_pe = nf_inq_base_pe(ncid, pe)
|
||||
end function nf90_inq_base_pe
|
||||
! -------
|
||||
function nf90_set_base_pe(ncid, pe)
|
||||
integer, intent( in) :: ncid, pe
|
||||
integer :: nf90_set_base_pe
|
||||
|
||||
nf90_set_base_pe = nf_set_base_pe(ncid, pe)
|
||||
end function nf90_set_base_pe
|
||||
! -------
|
||||
function nf90_create_mp(path, cmode, initalsz, basepe, chunksizehint, ncid)
|
||||
character (len = *), intent( in) :: path
|
||||
integer, intent( in) :: cmode, initalsz, basepe, chunksizehint
|
||||
integer, intent(out) :: ncid
|
||||
integer :: nf90_create_mp
|
||||
|
||||
nf90_create_mp = nf__create_mp(path, cmode, initalsz, basepe, chunksizehint, ncid)
|
||||
end function nf90_create_mp
|
||||
! -------
|
||||
function nf90_open_mp(path, mode, basepe, chunksizeint, ncid)
|
||||
character (len = *), intent( in) :: path
|
||||
integer, intent( in) :: mode, basepe, chunksizeint
|
||||
integer, intent(out) :: ncid
|
||||
integer :: nf90_open_mp
|
||||
|
||||
nf90_open_mp = nf__open_mp(path, mode, basepe, chunksizeint, ncid)
|
||||
end function nf90_open_mp
|
||||
! -------
|
||||
function nf90_set_fill(ncid, fillmode, old_mode)
|
||||
integer, intent( in) :: ncid, fillmode
|
||||
integer, intent(out) :: old_mode
|
||||
integer :: nf90_set_fill
|
||||
|
||||
nf90_set_fill = nf_set_fill(ncid, fillmode, old_mode)
|
||||
end function nf90_set_fill
|
||||
! -------
|
||||
function nf90_redef(ncid)
|
||||
integer, intent( in) :: ncid
|
||||
integer :: nf90_redef
|
||||
|
||||
nf90_redef = nf_redef(ncid)
|
||||
end function nf90_redef
|
||||
! -------
|
||||
function nf90_enddef(ncid, h_minfree, v_align, v_minfree, r_align)
|
||||
integer, intent( in) :: ncid
|
||||
integer, optional, intent( in) :: h_minfree, v_align, v_minfree, r_align
|
||||
integer :: nf90_enddef
|
||||
|
||||
integer :: hMinFree, VAlign, VMinFree, RAlign
|
||||
|
||||
if(.not. any( (/ present(h_minfree), present(v_align), &
|
||||
present(v_minfree), present(r_align) /) ) )then
|
||||
nf90_enddef = nf_enddef(ncid)
|
||||
else
|
||||
! Default values per the man page
|
||||
hMinFree = 0; VMinFree = 0
|
||||
VAlign = 4; RAlign = 4
|
||||
if(present(h_minfree)) HMinFree = h_minfree
|
||||
if(present(v_align )) VAlign = v_align
|
||||
if(present(v_minfree)) VMinFree = v_minfree
|
||||
if(present(r_align )) RAlign = r_align
|
||||
nf90_enddef = nf__enddef(ncid, hMinFree, VAlign, VMinFree, RAlign)
|
||||
end if
|
||||
end function nf90_enddef
|
||||
! -------
|
||||
function nf90_sync(ncid)
|
||||
integer, intent( in) :: ncid
|
||||
integer :: nf90_sync
|
||||
|
||||
nf90_sync = nf_sync(ncid)
|
||||
end function nf90_sync
|
||||
! -------
|
||||
function nf90_abort(ncid)
|
||||
integer, intent( in) :: ncid
|
||||
integer :: nf90_abort
|
||||
|
||||
nf90_abort = nf_abort(ncid)
|
||||
end function nf90_abort
|
||||
! -------
|
||||
function nf90_close(ncid)
|
||||
integer, intent( in) :: ncid
|
||||
integer :: nf90_close
|
||||
|
||||
nf90_close = nf_close(ncid)
|
||||
end function nf90_close
|
||||
! -------
|
||||
function nf90_delete(name)
|
||||
character(len = *), intent( in) :: name
|
||||
integer :: nf90_delete
|
||||
|
||||
nf90_delete = nf_delete(name)
|
||||
end function nf90_delete
|
||||
|
||||
!
|
||||
! A single file level inquiry routine
|
||||
!
|
||||
function nf90_inquire(ncid, nDimensions, nVariables, nAttributes, unlimitedDimId, formatNum)
|
||||
integer, intent( in) :: ncid
|
||||
integer, optional, intent(out) :: nDimensions, nVariables, nAttributes, unlimitedDimId, formatNum
|
||||
integer :: nf90_inquire
|
||||
|
||||
integer :: nDims, nVars, nGAtts, unlimDimId, frmt
|
||||
|
||||
nf90_inquire = nf_inq(ncid, nDims, nVars, nGAtts, unlimDimId)
|
||||
if(present(nDimensions)) nDimensions = nDims
|
||||
if(present(nVariables)) nVariables = nVars
|
||||
if(present(nAttributes)) nAttributes = nGAtts
|
||||
if(present(unlimitedDimId)) unlimitedDimId = unlimDimId
|
||||
if(present(formatNum)) then
|
||||
nf90_inquire = nf_inq_format(ncid, frmt)
|
||||
formatNum = frmt
|
||||
endif
|
||||
end function nf90_inquire
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ endif
|
||||
|
||||
# Does the user want to build the gridspec?
|
||||
if BUILD_GRIDSPEC
|
||||
GRIDSPEC = gridspec
|
||||
#GRIDSPEC = gridspec
|
||||
endif
|
||||
|
||||
SUBDIRS = $(GRIDSPEC) src $(CFCHECK) $(DOC)
|
||||
|
@ -417,20 +417,20 @@ AC_CONFIG_FILES([gridspec/tools/make_topog/run_tests],
|
||||
AC_CONFIG_FILES([Makefile
|
||||
doc/Makefile
|
||||
cfcheck/Makefile
|
||||
src/Makefile
|
||||
gridspec/Makefile
|
||||
gridspec/shared/Makefile
|
||||
gridspec/shared/mosaic/Makefile
|
||||
gridspec/tools/Makefile
|
||||
gridspec/tools/shared/Makefile
|
||||
gridspec/tools/make_hgrid/Makefile
|
||||
gridspec/tools/make_solo_mosaic/Makefile
|
||||
gridspec/tools/make_coupler_mosaic/Makefile
|
||||
gridspec/tools/fregrid/Makefile
|
||||
gridspec/tools/make_topog/Makefile
|
||||
gridspec/tools/make_vgrid/Makefile
|
||||
gridspec/tools/river_regrid/Makefile
|
||||
gridspec/tools/transfer_to_mosaic_grid/Makefile])
|
||||
src/Makefile])
|
||||
dnl gridspec/Makefile
|
||||
dnl gridspec/shared/Makefile
|
||||
dnl gridspec/shared/mosaic/Makefile
|
||||
dnl gridspec/tools/Makefile
|
||||
dnl gridspec/tools/shared/Makefile
|
||||
dnl gridspec/tools/make_hgrid/Makefile
|
||||
dnl gridspec/tools/make_solo_mosaic/Makefile
|
||||
dnl gridspec/tools/make_coupler_mosaic/Makefile
|
||||
dnl gridspec/tools/fregrid/Makefile
|
||||
dnl gridspec/tools/make_topog/Makefile
|
||||
dnl gridspec/tools/make_vgrid/Makefile
|
||||
dnl gridspec/tools/river_regrid/Makefile
|
||||
dnl gridspec/tools/transfer_to_mosaic_grid/Makefile])
|
||||
|
||||
AC_OUTPUT()
|
||||
|
||||
|
@ -5,8 +5,6 @@
|
||||
# This automake file is in charge of building the gridspec
|
||||
# tools/shared convenience library.
|
||||
|
||||
# $Id: Makefile.am,v 1.5 2010/05/29 01:46:31 dmh Exp $
|
||||
|
||||
noinst_LTLIBRARIES = libshared.la
|
||||
libshared_la_SOURCES = constant.h create_xgrid.c create_xgrid.h \
|
||||
gradient_c2l.c gradient_c2l.h interp.c interp.h mosaic_util.c \
|
||||
@ -18,8 +16,8 @@ LDADD =
|
||||
|
||||
AM_CPPFLAGS += -I${top_srcdir}/src
|
||||
|
||||
AM_CPPFLAGS += ${top_srcdir}../liblib
|
||||
AM_LDFLAGS += ${top_builddir}../liblib/libnetcdf.la
|
||||
AM_CPPFLAGS += ${top_srcdir}/../liblib
|
||||
AM_LDFLAGS += ${top_builddir}/../liblib/libnetcdf.la
|
||||
|
||||
AM_LDFLAGS += @EXTERN_LDFLAGS@ -lm
|
||||
|
||||
|
@ -5,8 +5,6 @@
|
||||
# This automake file is in charge of building the gridspec make_hgrid
|
||||
# tools.
|
||||
|
||||
# $Id: Makefile.am,v 1.8 2010/05/29 01:46:33 dmh Exp $
|
||||
|
||||
bin_PROGRAMS = make_hgrid gs_make_hgrid
|
||||
make_hgrid_SOURCES = make_hgrid.c create_conformal_cubic_grid.c \
|
||||
create_gnomonic_cubic_grid.c create_grid_from_file.c create_hgrid.h \
|
||||
@ -15,20 +13,26 @@ gs_make_hgrid_SOURCES = gs_make_hgrid.c create_conformal_cubic_grid.c \
|
||||
create_gnomonic_cubic_grid.c create_grid_from_file.c create_hgrid.h \
|
||||
create_lonlat_grid.c
|
||||
|
||||
AM_CPPFLAGS = -I${top_srcdir}/shared -I${top_srcdir}/shared/mosaic \
|
||||
-I${top_srcdir}/gridspec/shared -I${top_srcdir}/gridspec/shared/mosaic \
|
||||
-I${top_srcdir}/make_hgrid -I${top_srcdir}/gridspec/tools/fregrid \
|
||||
-I${top_srcdir}/gridspec/tools/shared \
|
||||
-I${top_srcdir}/gridspec/tools/make_coupler_mosaic \
|
||||
-I${top_srcdir}/gridspec/tools/make_topog \
|
||||
-I${top_srcdir}/gridspec/tools/make_hgrid \
|
||||
-I${top_srcdir}/gridspec/tools/make_solo_mosaic \
|
||||
-I${top_srcdir}/gridspec/tools/make_vgrid \
|
||||
-I${top_srcdir}/gridspec/tools/river_regrid \
|
||||
-I${top_srcdir}/gridspec/tools/transfer_to_mosaic_grid
|
||||
|
||||
# Initalize these.
|
||||
AM_CPPFLAGS =
|
||||
AM_LDFLAGS =
|
||||
LDADD =
|
||||
|
||||
AM_CPPFLAGS += -I${top_srcdir}/shared -I${top_srcdir}/shared/mosaic
|
||||
AM_LDFLAGS += -L${top_builddir}/shared -L${top_builddir}/shared/mosaic -ltoolsshared -lshared
|
||||
AM_LDFLAGS = -L${top_builddir}/gridspec/shared \
|
||||
-L${top_builddir}/gridspec/shared/mosaic -ltoolsshared -lshared
|
||||
|
||||
if USE_NETCDF_DIR
|
||||
AM_CPPFLAGS += -I@NETCDFDIR@/include
|
||||
AM_LDFLAGS += -L@NETCDFDIR@/lib
|
||||
else
|
||||
AM_CPPFLAGS += -I${top_srcdir}/../liblib
|
||||
AM_CPPFLAGS += -I${top_srcdir}/.. -I${top_srcdir}/../liblib
|
||||
AM_LDFLAGS += ${top_builddir}/../liblib/libnetcdf.la
|
||||
endif
|
||||
|
||||
|
@ -15,33 +15,27 @@ create_conformal_cubic_grid.c fregrid_util.c conserve_interp.c \
|
||||
bilinear_interp.c topog.c get_contact.c create_vgrid.c \
|
||||
transfer_to_mosaic.c
|
||||
|
||||
|
||||
# Initalize these.
|
||||
AM_CPPFLAGS =
|
||||
AM_LDFLAGS =
|
||||
LDADD =
|
||||
|
||||
AM_CPPFLAGS +=\
|
||||
-I${top_srcdir}/shared \
|
||||
-I${top_srcdir}/shared/mosaic \
|
||||
-I${top_srcdir}/make_hgrid \
|
||||
-I${top_srcdir}/fregrid \
|
||||
-I${top_srcdir}/make_coupler_mosaic \
|
||||
-I${top_srcdir}/make_topog \
|
||||
-I${top_srcdir}/make_solo_mosaic \
|
||||
-I${top_srcdir}/make_vgrid \
|
||||
-I${top_srcdir}/river_regrid \
|
||||
-I${top_srcdir}/transfer_to_mosaic_grid
|
||||
AM_CPPFLAGS = -I${top_srcdir}/gridspec/shared \
|
||||
-I${top_srcdir}/gridspec/shared/mosaic -I${top_srcdir}/make_hgrid \
|
||||
-I${top_srcdir}/gridspec/tools/fregrid \
|
||||
-I${top_srcdir}/gridspec/tools/make_coupler_mosaic \
|
||||
-I${top_srcdir}/gridspec/tools/make_topog \
|
||||
-I${top_srcdir}/gridspec/tools/make_hgrid \
|
||||
-I${top_srcdir}/gridspec/tools/make_solo_mosaic \
|
||||
-I${top_srcdir}/gridspec/tools/make_vgrid \
|
||||
-I${top_srcdir}/gridspec/tools/river_regrid \
|
||||
-I${top_srcdir}/gridspec/tools/transfer_to_mosaic_grid
|
||||
|
||||
if USE_NETCDF_DIR
|
||||
AM_CPPFLAGS += -I@NETCDFDIR@/include
|
||||
AM_LDFLAGS += -L@NETCDFDIR@/lib
|
||||
else
|
||||
AM_CPPFLAGS += -I${top_srcdir}/../liblib
|
||||
AM_CPPFLAGS += -I${top_srcdir}/.. -I${top_srcdir}/../liblib
|
||||
AM_LDFLAGS += ${top_builddir}/../liblib/libnetcdf.la
|
||||
endif
|
||||
|
||||
AM_LDFLAGS += @EXTERN_LDFLAGS@ -lm
|
||||
|
||||
|
||||
|
||||
|
@ -9,38 +9,33 @@
|
||||
|
||||
# $Id: Makefile.am,v 1.10 2010/06/01 15:34:50 ed Exp $
|
||||
|
||||
# Set up include directories.
|
||||
AM_CPPFLAGS = -I${top_srcdir}/include -I${top_srcdir}/liblib -I${top_srcdir}/libsrc
|
||||
|
||||
# This is our output
|
||||
noinst_LTLIBRARIES = libdispatch.la
|
||||
|
||||
# The source files.
|
||||
libdispatch_la_SOURCES = netcdf.m4 dispatch.h parallel.c copy.c \
|
||||
error.c
|
||||
libdispatch_la_SOURCES = dispatch.h parallel.c copy.c file.c dim.c \
|
||||
att.c error.c var.c dispatch.c
|
||||
|
||||
# Add functions only found in netCDF-4.
|
||||
if USE_NETCDF4
|
||||
libdispatch_la_SOURCES += nc4.c
|
||||
endif
|
||||
endif # USE_NETCDF4
|
||||
|
||||
# Does the user want the V2 API?
|
||||
# Add functions needed by opendap client.
|
||||
if USE_DAP
|
||||
libdispatch_la_SOURCES += dap.c
|
||||
AM_CPPFLAGS += -I${top_srcdir}/oc
|
||||
endif # USE_DAP
|
||||
|
||||
# Add V2 API functions.
|
||||
if BUILD_V2
|
||||
noinst_LTLIBRARIES += libnetcdf2.la
|
||||
libnetcdf2_la_SOURCES = v2i.c
|
||||
endif # BUILD_V2
|
||||
|
||||
# Include this so that user does not have to have m4.
|
||||
EXTRA_DIST = netcdf.c
|
||||
|
||||
# Set up include directories.
|
||||
AM_CPPFLAGS = -I${top_srcdir}/include -I${top_srcdir}/liblib -I${top_srcdir}/libsrc
|
||||
if USE_DAP
|
||||
AM_CPPFLAGS += -I${top_srcdir}/oc
|
||||
endif
|
||||
|
||||
# Clean up.
|
||||
MAINTAINERCLEANFILES = netcdf.c
|
||||
|
||||
# This tells make how to turn .m4 files into .c files.
|
||||
.m4.c:
|
||||
if test -f $@ ; then rm -f $@.bak ; cp $@ $@.bak ; fi
|
||||
m4 $(AM_M4FLAGS) $(M4FLAGS) $< >$@
|
||||
|
||||
|
||||
|
||||
|
@ -46,6 +46,7 @@ extern int nc_put_vara_ulonglong(int ncid, int varid,
|
||||
const size_t* start, const size_t* count,
|
||||
const unsigned long long* value);
|
||||
|
||||
#define X_INT_MAX 2147483647
|
||||
|
||||
/* Given a filename, check its magic number */
|
||||
#define MAGIC_NUMBER_LEN 4
|
||||
|
@ -2,9 +2,7 @@
|
||||
Copyright 2010 University Corporation for Atmospheric
|
||||
Research/Unidata. See COPYRIGHT file for more info.
|
||||
|
||||
This file defines most of the netcdf API in terms of the dispatch
|
||||
functions along with a few functions that are overlays over the
|
||||
dispatch functions.
|
||||
This file defines the netcdf-4 functions.
|
||||
|
||||
"$Id: nc4.c,v 1.1 2010/06/01 15:46:50 ed Exp $"
|
||||
*/
|
||||
@ -213,3 +211,443 @@ nc_inq_var_endian(int ncid, int varid, int *endianp)
|
||||
NULL /*pixelsp*/
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nc_inq_ncid(int ncid, const char *name, int *grp_ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_ncid(ncid,name,grp_ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grps(int ncid, int *numgrps, int *ncids)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_grps(ncid,numgrps,ncids);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grpname(int ncid, char *name)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_grpname(ncid,name);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grpname_full(int ncid, size_t *lenp, char *full_name)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_grpname_full(ncid,lenp,full_name);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grpname_len(int ncid, size_t *lenp)
|
||||
{
|
||||
int stat = nc_inq_grpname_full(ncid,lenp,NULL);
|
||||
return stat;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grp_parent(int ncid, int *parent_ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_grp_parent(ncid,parent_ncid);
|
||||
}
|
||||
|
||||
/* This has same semantics as nc_inq_ncid */
|
||||
int
|
||||
nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid)
|
||||
{
|
||||
return nc_inq_ncid(ncid,grp_name,grp_ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_grp_full_ncid(int ncid, const char *full_name, int *grp_ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_grp_full_ncid(ncid,full_name,grp_ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_varids(int ncid, int *nvars, int *varids)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_varids(ncid,nvars,varids);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_dimids(ncid,ndims,dimids,include_parents);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_typeids(int ncid, int *ntypes, int *typeids)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_typeids(ncid,ntypes,typeids);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_type_equal(int ncid1, nc_type typeid1, int ncid2,
|
||||
nc_type typeid2, int *equal)
|
||||
{
|
||||
NC* ncp1;
|
||||
int stat = NC_check_id(ncid1,&ncp1);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp1->dispatch->inq_type_equal(ncid1,typeid1,ncid2,typeid2,equal);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_grp(int parent_ncid, const char *name, int *new_ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(parent_ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_grp(parent_ncid,name,new_ncid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_compound(ncid,size,name,typeidp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_insert_compound(int ncid, nc_type xtype, const char *name, size_t offset, nc_type field_typeid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->insert_compound(ncid,xtype,name,offset,field_typeid);
|
||||
}
|
||||
|
||||
int
|
||||
nc_insert_array_compound(int ncid, nc_type xtype, const char *name, size_t offset, nc_type field_typeid, int ndims, const int *dim_sizes)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->insert_array_compound(ncid,xtype,name,offset,field_typeid,ndims,dim_sizes);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_typeid(int ncid, const char *name, nc_type *typeidp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_typeid(ncid,name,typeidp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound(int ncid, nc_type xtype, char *name, size_t *sizep, size_t *nfieldsp)
|
||||
{
|
||||
int class = 0;
|
||||
int stat = nc_inq_user_type(ncid,xtype,name,sizep,NULL,nfieldsp,&class);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
if(class != NC_COMPOUND) stat = NC_EBADTYPE;
|
||||
return stat;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_name(int ncid, nc_type xtype, char *name)
|
||||
{
|
||||
return nc_inq_compound(ncid,xtype,name,NULL,NULL);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_size(int ncid, nc_type xtype, size_t *sizep)
|
||||
{
|
||||
return nc_inq_compound(ncid,xtype,NULL,sizep,NULL);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_nfields(int ncid, nc_type xtype, size_t *nfieldsp)
|
||||
{
|
||||
return nc_inq_compound(ncid,xtype,NULL,NULL,nfieldsp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_field(int ncid, nc_type xtype, int fieldid, char *name, size_t *offsetp, nc_type *field_typeidp, int *ndimsp, int *dim_sizesp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_field(ncid,xtype,fieldid,name,offsetp,field_typeidp,ndimsp,dim_sizesp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_fieldname(int ncid, nc_type xtype, int fieldid,
|
||||
char *name)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_field(ncid,xtype,fieldid,name,NULL,NULL,NULL,NULL);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_fieldoffset(int ncid, nc_type xtype, int fieldid,
|
||||
size_t *offsetp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_field(ncid,xtype,fieldid,NULL,offsetp,NULL,NULL,NULL);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_fieldtype(int ncid, nc_type xtype, int fieldid,
|
||||
nc_type *field_typeidp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_field(ncid,xtype,fieldid,NULL,NULL,field_typeidp,NULL,NULL);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_fieldndims(int ncid, nc_type xtype, int fieldid,
|
||||
int *ndimsp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_field(ncid,xtype,fieldid,NULL,NULL,NULL,ndimsp,NULL);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_fielddim_sizes(int ncid, nc_type xtype, int fieldid,
|
||||
int *dim_sizes)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_field(ncid,xtype,fieldid,NULL,NULL,NULL,NULL,dim_sizes);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_compound_fieldindex(int ncid, nc_type xtype, const char *name,
|
||||
int *fieldidp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_compound_fieldindex(ncid,xtype,name,fieldidp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_vlen(int ncid, const char *name, nc_type base_typeid, nc_type *xtypep)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_vlen(ncid,name,base_typeid,xtypep);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_vlen(int ncid, nc_type xtype, char *name, size_t *datum_sizep, nc_type *base_nc_typep)
|
||||
{
|
||||
int class = 0;
|
||||
int stat = nc_inq_user_type(ncid,xtype,name,datum_sizep,base_nc_typep,NULL,&class);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
if(class != NC_VLEN) stat = NC_EBADTYPE;
|
||||
return stat;
|
||||
}
|
||||
|
||||
int
|
||||
nc_put_vlen_element(int ncid, int typeid1, void *vlen_element, size_t len, const void *data)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->put_vlen_element(ncid,typeid1,vlen_element,len,data);
|
||||
}
|
||||
|
||||
int
|
||||
nc_get_vlen_element(int ncid, int typeid1, const void *vlen_element, size_t *len, void *data)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->get_vlen_element(ncid,typeid1,vlen_element,len,data);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_user_type(int ncid, nc_type xtype, char *name, size_t *size, nc_type *base_nc_typep, size_t *nfieldsp, int *classp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_user_type(ncid,xtype,name,size,base_nc_typep,nfieldsp,classp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_enum(int ncid, nc_type base_typeid, const char *name, nc_type *typeidp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_enum(ncid,base_typeid,name,typeidp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_insert_enum(int ncid, nc_type xtype, const char *name, const void *value)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->insert_enum(ncid,xtype,name,value);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_enum(int ncid, nc_type xtype, char *name, nc_type *base_nc_typep, size_t *base_sizep, size_t *num_membersp)
|
||||
{
|
||||
int class = 0;
|
||||
int stat = nc_inq_user_type(ncid,xtype,name,base_sizep,base_nc_typep,num_membersp,&class);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
if(class != NC_ENUM) stat = NC_EBADTYPE;
|
||||
return stat;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_enum_member(int ncid, nc_type xtype, int idx, char *name, void *value)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_enum_member(ncid,xtype,idx,name,value);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_enum_ident(ncid,xtype,value,identifier);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_opaque(int ncid, size_t size, const char *name, nc_type *xtypep)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_opaque(ncid,size,name,xtypep);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_opaque(int ncid, nc_type xtype, char *name, size_t *sizep)
|
||||
{
|
||||
int class = 0;
|
||||
int stat = nc_inq_user_type(ncid,xtype,name,sizep,NULL,NULL,&class);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
if(class != NC_OPAQUE) stat = NC_EBADTYPE;
|
||||
return stat;
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, int deflate_level)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_deflate(ncid,varid,shuffle,deflate,deflate_level);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_fletcher32(int ncid, int varid, int fletcher32)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_fletcher32(ncid,varid,fletcher32);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_chunking(ncid,varid,storage,chunksizesp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_fill(ncid,varid,no_fill,fill_value);
|
||||
}
|
||||
|
||||
int
|
||||
nc_def_var_endian(int ncid, int varid, int endian)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->def_var_endian(ncid,varid,endian);
|
||||
}
|
||||
|
||||
int
|
||||
nc_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, float preemption)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->set_var_chunk_cache(ncid,varid,size,nelems,preemption);
|
||||
}
|
||||
|
||||
int
|
||||
nc_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp, float *preemptionp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->get_var_chunk_cache(ncid,varid,sizep,nelemsp,preemptionp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->inq_unlimdims(ncid,nunlimdimsp,unlimdimidsp);
|
||||
}
|
||||
|
||||
int
|
||||
nc_show_metadata(int ncid)
|
||||
{
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid,&ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
return ncp->dispatch->show_metadata(ncid);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,8 +6,6 @@
|
||||
# libraries have been built. (e.g libsrc, libsrc4, libncdap3,
|
||||
# libncdap4, fortran).
|
||||
|
||||
# $Id: Makefile.am,v 1.13 2010/06/01 15:34:50 ed Exp $
|
||||
|
||||
AM_LDFLAGS = @EXTERN_LDFLAGS@
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
|
@ -64,9 +64,6 @@ libncdap3_la_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
libncdap3_la_LIBADD =
|
||||
|
||||
AM_CPPFLAGS += -I${top_srcdir}/libdispatch
|
||||
AM_LDFLAGS += ${top_builddir}/libsrc/libnetcdf3.la \
|
||||
${top_builddir}/libsrc/libnetcdf2.la \
|
||||
${top_builddir}/libdispatch/libdispatch.la
|
||||
|
||||
if USE_NETCDF4
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/libsrc4 -I$(top_srcdir)/libsrc
|
||||
@ -87,7 +84,11 @@ LDADD += ${top_builddir}/libncdap3/libncdap3.la ${AM_LDFLAGS}
|
||||
# Add a trivial test case to check for undefined references
|
||||
check_PROGRAMS = t_dap
|
||||
TESTS = t_dap
|
||||
t_dap_SOURCES=t_dap.c stubdap3.c
|
||||
t_dap_SOURCES = t_dap.c stubdap3.c
|
||||
t_dap_LDFLAGS = ${top_builddir}/libsrc/libnetcdf3.la \
|
||||
${top_builddir}/libdispatch/libdispatch.la
|
||||
|
||||
|
||||
CLEANFILES += t_dap
|
||||
|
||||
endif # BUILD_DAP
|
||||
|
@ -48,9 +48,12 @@ AM_LDFLAGS += @EXTERN_LDFLAGS@
|
||||
AM_LDFLAGS += ${top_builddir}/libncdap3/libncdap3.la \
|
||||
${top_builddir}/libsrc4/libnetcdf4.la \
|
||||
${top_builddir}/libsrc/libnetcdf3.la \
|
||||
${top_builddir}/libsrc/libnetcdf2.la \
|
||||
${top_builddir}/libdispatch/libdispatch.la
|
||||
|
||||
if BUILD_V2
|
||||
AM_LDFLAGS += ${top_builddir}/libdispatch/libnetcdf2.la
|
||||
endif # BUILD_V2
|
||||
|
||||
AM_LDFLAGS += @EXTERN_LDFLAGS@
|
||||
|
||||
LDADD += ${top_builddir}/libncdap4/libncdap4.la ${AM_LDFLAGS}
|
||||
|
@ -52,16 +52,6 @@ if USE_DAP
|
||||
LDADD += ${top_builddir}/oc/liboc.la
|
||||
endif
|
||||
|
||||
# Test the netCDF-3 library.
|
||||
TESTPROGRAMS = t_nc
|
||||
if !USE_NETCDF4
|
||||
TESTPROGRAMS += t_type
|
||||
endif
|
||||
check_PROGRAMS = $(TESTPROGRAMS)
|
||||
TESTS = $(TESTPROGRAMS)
|
||||
|
||||
CLEANFILES = t_nc test.nc
|
||||
|
||||
# These files are cleaned on developer workstations (and then rebuilt
|
||||
# with m4), but they are included in the distribution so that the user
|
||||
# does not have to have m4.
|
||||
|
@ -2,7 +2,6 @@
|
||||
* Copyright 1996, University Corporation for Atmospheric Research
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
*/
|
||||
/* $Id: nc.c,v 2.173 2010/05/26 20:13:31 dmh Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
|
2211
libsrc/old_attr.c
2211
libsrc/old_attr.c
File diff suppressed because it is too large
Load Diff
544
libsrc/old_dim.c
544
libsrc/old_dim.c
@ -1,544 +0,0 @@
|
||||
/*
|
||||
* Copyright 1996, University Corporation for Atmospheric Research
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
*/
|
||||
/* $Id: old_dim.c,v 2.1 2010/05/25 17:54:16 dmh Exp $ */
|
||||
|
||||
#include "nc.h"
|
||||
#include "rename.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "ncx.h"
|
||||
#include "fbits.h"
|
||||
#include "utf8proc.h"
|
||||
|
||||
/*
|
||||
* Free dim
|
||||
* Formerly
|
||||
NC_free_dim(dim)
|
||||
*/
|
||||
void
|
||||
free_NC_dim(NC_dim *dimp)
|
||||
{
|
||||
if(dimp == NULL)
|
||||
return;
|
||||
free_NC_string(dimp->name);
|
||||
free(dimp);
|
||||
}
|
||||
|
||||
|
||||
NC_dim *
|
||||
new_x_NC_dim(NC_string *name)
|
||||
{
|
||||
NC_dim *dimp;
|
||||
|
||||
dimp = (NC_dim *) malloc(sizeof(NC_dim));
|
||||
if(dimp == NULL)
|
||||
return NULL;
|
||||
|
||||
dimp->name = name;
|
||||
dimp->size = 0;
|
||||
|
||||
return(dimp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Formerly
|
||||
NC_new_dim(const char *uname, long size)
|
||||
*/
|
||||
static NC_dim *
|
||||
new_NC_dim(const char *uname, size_t size)
|
||||
{
|
||||
NC_string *strp;
|
||||
NC_dim *dimp;
|
||||
|
||||
char *name = (char *)utf8proc_NFC((const unsigned char *)uname);
|
||||
if(name == NULL)
|
||||
return NULL;
|
||||
strp = new_NC_string(strlen(name), name);
|
||||
free(name);
|
||||
if(strp == NULL)
|
||||
return NULL;
|
||||
|
||||
dimp = new_x_NC_dim(strp);
|
||||
if(dimp == NULL)
|
||||
{
|
||||
free_NC_string(strp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dimp->size = size;
|
||||
|
||||
return(dimp);
|
||||
}
|
||||
|
||||
|
||||
static NC_dim *
|
||||
dup_NC_dim(const NC_dim *dimp)
|
||||
{
|
||||
return new_NC_dim(dimp->name->cp, dimp->size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Step thru NC_DIMENSION array, seeking the UNLIMITED dimension.
|
||||
* Return dimid or -1 on not found.
|
||||
* *dimpp is set to the appropriate NC_dim.
|
||||
* The loop structure is odd. In order to parallelize,
|
||||
* we moved a clearer 'break' inside the loop body to the loop test.
|
||||
*/
|
||||
int
|
||||
find_NC_Udim(const NC_dimarray *ncap, NC_dim **dimpp)
|
||||
{
|
||||
assert(ncap != NULL);
|
||||
|
||||
if(ncap->nelems == 0)
|
||||
return -1;
|
||||
|
||||
{
|
||||
int dimid = 0;
|
||||
NC_dim **loc = ncap->value;
|
||||
|
||||
for(; (size_t) dimid < ncap->nelems
|
||||
&& (*loc)->size != NC_UNLIMITED; dimid++, loc++)
|
||||
{
|
||||
/*EMPTY*/
|
||||
}
|
||||
if(dimid >= ncap->nelems)
|
||||
return(-1); /* not found */
|
||||
/* else, normal return */
|
||||
if(dimpp != NULL)
|
||||
*dimpp = *loc;
|
||||
return dimid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Step thru NC_DIMENSION array, seeking match on uname.
|
||||
* Return dimid or -1 on not found.
|
||||
* *dimpp is set to the appropriate NC_dim.
|
||||
* The loop structure is odd. In order to parallelize,
|
||||
* we moved a clearer 'break' inside the loop body to the loop test.
|
||||
*/
|
||||
static int
|
||||
NC_finddim(const NC_dimarray *ncap, const char *uname, NC_dim **dimpp)
|
||||
{
|
||||
|
||||
int dimid;
|
||||
size_t slen;
|
||||
NC_dim ** loc;
|
||||
char *name;
|
||||
|
||||
assert(ncap != NULL);
|
||||
|
||||
if(ncap->nelems == 0)
|
||||
return -1;
|
||||
|
||||
{
|
||||
dimid = 0;
|
||||
loc = (NC_dim **) ncap->value;
|
||||
/* normalized version of uname */
|
||||
name = (char *)utf8proc_NFC((const unsigned char *)uname);
|
||||
if(name == NULL)
|
||||
return NC_ENOMEM;
|
||||
slen = strlen(name);
|
||||
|
||||
for(; (size_t) dimid < ncap->nelems
|
||||
&& (strlen((*loc)->name->cp) != slen
|
||||
|| strncmp((*loc)->name->cp, name, slen) != 0);
|
||||
dimid++, loc++)
|
||||
{
|
||||
/*EMPTY*/
|
||||
}
|
||||
free(name);
|
||||
if(dimid >= ncap->nelems)
|
||||
return(-1); /* not found */
|
||||
/* else, normal return */
|
||||
if(dimpp != NULL)
|
||||
*dimpp = *loc;
|
||||
return(dimid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* dimarray */
|
||||
|
||||
|
||||
/*
|
||||
* Free the stuff "in" (referred to by) an NC_dimarray.
|
||||
* Leaves the array itself allocated.
|
||||
*/
|
||||
void
|
||||
free_NC_dimarrayV0(NC_dimarray *ncap)
|
||||
{
|
||||
assert(ncap != NULL);
|
||||
|
||||
if(ncap->nelems == 0)
|
||||
return;
|
||||
|
||||
assert(ncap->value != NULL);
|
||||
|
||||
{
|
||||
NC_dim **dpp = ncap->value;
|
||||
NC_dim *const *const end = &dpp[ncap->nelems];
|
||||
for( /*NADA*/; dpp < end; dpp++)
|
||||
{
|
||||
free_NC_dim(*dpp);
|
||||
*dpp = NULL;
|
||||
}
|
||||
}
|
||||
ncap->nelems = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free NC_dimarray values.
|
||||
* formerly
|
||||
NC_free_array()
|
||||
*/
|
||||
void
|
||||
free_NC_dimarrayV(NC_dimarray *ncap)
|
||||
{
|
||||
assert(ncap != NULL);
|
||||
|
||||
if(ncap->nalloc == 0)
|
||||
return;
|
||||
|
||||
assert(ncap->value != NULL);
|
||||
|
||||
free_NC_dimarrayV0(ncap);
|
||||
|
||||
free(ncap->value);
|
||||
ncap->value = NULL;
|
||||
ncap->nalloc = 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
dup_NC_dimarrayV(NC_dimarray *ncap, const NC_dimarray *ref)
|
||||
{
|
||||
int status = NC_NOERR;
|
||||
|
||||
assert(ref != NULL);
|
||||
assert(ncap != NULL);
|
||||
|
||||
if(ref->nelems != 0)
|
||||
{
|
||||
const size_t sz = ref->nelems * sizeof(NC_dim *);
|
||||
ncap->value = (NC_dim **) malloc(sz);
|
||||
if(ncap->value == NULL)
|
||||
return NC_ENOMEM;
|
||||
(void) memset(ncap->value, 0, sz);
|
||||
ncap->nalloc = ref->nelems;
|
||||
}
|
||||
|
||||
ncap->nelems = 0;
|
||||
{
|
||||
NC_dim **dpp = ncap->value;
|
||||
const NC_dim **drpp = (const NC_dim **)ref->value;
|
||||
NC_dim *const *const end = &dpp[ref->nelems];
|
||||
for( /*NADA*/; dpp < end; drpp++, dpp++, ncap->nelems++)
|
||||
{
|
||||
*dpp = dup_NC_dim(*drpp);
|
||||
if(*dpp == NULL)
|
||||
{
|
||||
status = NC_ENOMEM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(status != NC_NOERR)
|
||||
{
|
||||
free_NC_dimarrayV(ncap);
|
||||
return status;
|
||||
}
|
||||
|
||||
assert(ncap->nelems == ref->nelems);
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add a new handle on the end of an array of handles
|
||||
* Formerly
|
||||
NC_incr_array(array, tail)
|
||||
*/
|
||||
static int
|
||||
incr_NC_dimarray(NC_dimarray *ncap, NC_dim *newelemp)
|
||||
{
|
||||
NC_dim **vp;
|
||||
|
||||
assert(ncap != NULL);
|
||||
|
||||
if(ncap->nalloc == 0)
|
||||
{
|
||||
assert(ncap->nelems == 0);
|
||||
vp = (NC_dim **) malloc(NC_ARRAY_GROWBY * sizeof(NC_dim *));
|
||||
if(vp == NULL)
|
||||
return NC_ENOMEM;
|
||||
ncap->value = vp;
|
||||
ncap->nalloc = NC_ARRAY_GROWBY;
|
||||
}
|
||||
else if(ncap->nelems +1 > ncap->nalloc)
|
||||
{
|
||||
vp = (NC_dim **) realloc(ncap->value,
|
||||
(ncap->nalloc + NC_ARRAY_GROWBY) * sizeof(NC_dim *));
|
||||
if(vp == NULL)
|
||||
return NC_ENOMEM;
|
||||
ncap->value = vp;
|
||||
ncap->nalloc += NC_ARRAY_GROWBY;
|
||||
}
|
||||
|
||||
if(newelemp != NULL)
|
||||
{
|
||||
ncap->value[ncap->nelems] = newelemp;
|
||||
ncap->nelems++;
|
||||
}
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
|
||||
NC_dim *
|
||||
elem_NC_dimarray(const NC_dimarray *ncap, size_t elem)
|
||||
{
|
||||
assert(ncap != NULL);
|
||||
/* cast needed for braindead systems with signed size_t */
|
||||
if(ncap->nelems == 0 || (unsigned long) elem >= ncap->nelems)
|
||||
return NULL;
|
||||
|
||||
assert(ncap->value != NULL);
|
||||
|
||||
return ncap->value[elem];
|
||||
}
|
||||
|
||||
|
||||
/* Public */
|
||||
|
||||
int
|
||||
nc_def_dim(int ncid, const char *name, size_t size, int *dimidp)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
int dimid;
|
||||
NC_dim *dimp;
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
if(!NC_indef(ncp))
|
||||
return NC_ENOTINDEFINE;
|
||||
|
||||
status = NC_check_name(name);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
if ((ncp->flags & NC_64BIT_OFFSET) && sizeof(off_t) > 4) {
|
||||
/* CDF2 format and LFS */
|
||||
if(size > X_UINT_MAX - 3) /* "- 3" handles rounded-up size */
|
||||
return NC_EDIMSIZE;
|
||||
} else {
|
||||
/* CDF1 format */
|
||||
if(size > X_INT_MAX - 3)
|
||||
return NC_EDIMSIZE;
|
||||
}
|
||||
|
||||
if(size == NC_UNLIMITED)
|
||||
{
|
||||
dimid = find_NC_Udim(&ncp->dims, &dimp);
|
||||
if(dimid != -1)
|
||||
{
|
||||
assert(dimid != -1);
|
||||
return NC_EUNLIMIT;
|
||||
}
|
||||
}
|
||||
|
||||
if(ncp->dims.nelems >= NC_MAX_DIMS)
|
||||
return NC_EMAXDIMS;
|
||||
|
||||
dimid = NC_finddim(&ncp->dims, name, &dimp);
|
||||
if(dimid != -1)
|
||||
return NC_ENAMEINUSE;
|
||||
|
||||
dimp = new_NC_dim(name, size);
|
||||
if(dimp == NULL)
|
||||
return NC_ENOMEM;
|
||||
status = incr_NC_dimarray(&ncp->dims, dimp);
|
||||
if(status != NC_NOERR)
|
||||
{
|
||||
free_NC_dim(dimp);
|
||||
return status;
|
||||
}
|
||||
|
||||
if(dimidp != NULL)
|
||||
*dimidp = (int)ncp->dims.nelems -1;
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nc_inq_dimid(int ncid, const char *name, int *dimid_ptr)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
int dimid;
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
dimid = NC_finddim(&ncp->dims, name, NULL);
|
||||
|
||||
if(dimid == -1)
|
||||
return NC_EBADDIM;
|
||||
|
||||
*dimid_ptr = dimid;
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_dim(int ncid, int dimid, char *name, size_t *sizep)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
NC_dim *dimp;
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
dimp = elem_NC_dimarray(&ncp->dims, (size_t)dimid);
|
||||
if(dimp == NULL)
|
||||
return NC_EBADDIM;
|
||||
|
||||
if(name != NULL)
|
||||
{
|
||||
(void)strncpy(name, dimp->name->cp,
|
||||
dimp->name->nchars);
|
||||
name[dimp->name->nchars] = 0;
|
||||
}
|
||||
if(sizep != 0)
|
||||
{
|
||||
if(dimp->size == NC_UNLIMITED)
|
||||
*sizep = NC_get_numrecs(ncp);
|
||||
else
|
||||
*sizep = dimp->size;
|
||||
}
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_dimname(int ncid, int dimid, char *name)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
NC_dim *dimp;
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
dimp = elem_NC_dimarray(&ncp->dims, (size_t)dimid);
|
||||
if(dimp == NULL)
|
||||
return NC_EBADDIM;
|
||||
|
||||
if(name != NULL)
|
||||
{
|
||||
(void)strncpy(name, dimp->name->cp,
|
||||
dimp->name->nchars);
|
||||
name[dimp->name->nchars] = 0;
|
||||
}
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_dimlen(int ncid, int dimid, size_t *lenp)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
NC_dim *dimp;
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
dimp = elem_NC_dimarray(&ncp->dims, (size_t)dimid);
|
||||
if(dimp == NULL)
|
||||
return NC_EBADDIM;
|
||||
|
||||
if(lenp != 0)
|
||||
{
|
||||
if(dimp->size == NC_UNLIMITED)
|
||||
*lenp = NC_get_numrecs(ncp);
|
||||
else
|
||||
*lenp = dimp->size;
|
||||
}
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_rename_dim( int ncid, int dimid, const char *unewname)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
int existid;
|
||||
NC_dim *dimp;
|
||||
char *newname; /* normalized */
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
if(NC_readonly(ncp))
|
||||
return NC_EPERM;
|
||||
|
||||
status = NC_check_name(unewname);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
existid = NC_finddim(&ncp->dims, unewname, &dimp);
|
||||
if(existid != -1)
|
||||
return NC_ENAMEINUSE;
|
||||
|
||||
dimp = elem_NC_dimarray(&ncp->dims, (size_t)dimid);
|
||||
if(dimp == NULL)
|
||||
return NC_EBADDIM;
|
||||
|
||||
newname = (char *)utf8proc_NFC((const unsigned char *)unewname);
|
||||
if(newname == NULL)
|
||||
return NC_ENOMEM;
|
||||
if(NC_indef(ncp))
|
||||
{
|
||||
NC_string *old = dimp->name;
|
||||
NC_string *newStr = new_NC_string(strlen(newname), newname);
|
||||
free(newname);
|
||||
if(newStr == NULL)
|
||||
return NC_ENOMEM;
|
||||
dimp->name = newStr;
|
||||
free_NC_string(old);
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/* else, not in define mode */
|
||||
|
||||
status = set_NC_string(dimp->name, newname);
|
||||
free(newname);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
set_NC_hdirty(ncp);
|
||||
|
||||
if(NC_doHsync(ncp))
|
||||
{
|
||||
status = NC_sync(ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
}
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
1653
libsrc/old_nc.c
1653
libsrc/old_nc.c
File diff suppressed because it is too large
Load Diff
6857
libsrc/old_ncx.c
6857
libsrc/old_ncx.c
File diff suppressed because it is too large
Load Diff
11694
libsrc/old_putget.c
11694
libsrc/old_putget.c
File diff suppressed because it is too large
Load Diff
841
libsrc/old_var.c
841
libsrc/old_var.c
@ -1,841 +0,0 @@
|
||||
/*
|
||||
* Copyright 1996, University Corporation for Atmospheric Research
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
*/
|
||||
/* $Id: old_var.c,v 2.1 2010/05/25 17:54:18 dmh Exp $ */
|
||||
|
||||
#include "nc.h"
|
||||
#include "rename.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "ncx.h"
|
||||
#include "rnd.h"
|
||||
#include "utf8proc.h"
|
||||
|
||||
|
||||
/*
|
||||
* Free var
|
||||
* Formerly
|
||||
NC_free_var(var)
|
||||
*/
|
||||
void
|
||||
free_NC_var(NC_var *varp)
|
||||
{
|
||||
if(varp == NULL)
|
||||
return;
|
||||
free_NC_attrarrayV(&varp->attrs);
|
||||
free_NC_string(varp->name);
|
||||
free(varp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Common code for new_NC_var()
|
||||
* and ncx_get_NC_var()
|
||||
*/
|
||||
NC_var *
|
||||
new_x_NC_var(
|
||||
NC_string *strp,
|
||||
size_t ndims)
|
||||
{
|
||||
NC_var *varp;
|
||||
const size_t o1 = M_RNDUP(ndims * sizeof(int));
|
||||
const size_t o2 = M_RNDUP(ndims * sizeof(size_t));
|
||||
const size_t sz = M_RNDUP(sizeof(NC_var)) +
|
||||
o1 + o2 + ndims * sizeof(off_t);
|
||||
|
||||
varp = (NC_var *) malloc(sz);
|
||||
if(varp == NULL )
|
||||
return NULL;
|
||||
(void) memset(varp, 0, sz);
|
||||
|
||||
varp->name = strp;
|
||||
varp->ndims = ndims;
|
||||
|
||||
if(ndims != 0)
|
||||
{
|
||||
/*
|
||||
* NOTE: lint may complain about the next 3 lines:
|
||||
* "pointer cast may result in improper alignment".
|
||||
* We use the M_RNDUP() macro to get the proper alignment.
|
||||
*/
|
||||
varp->dimids = (int *)((char *)varp + M_RNDUP(sizeof(NC_var)));
|
||||
varp->shape = (size_t *)((char *)varp->dimids + o1);
|
||||
varp->dsizes = (off_t *)((char *)varp->shape + o2);
|
||||
}
|
||||
|
||||
varp->xsz = 0;
|
||||
varp->len = 0;
|
||||
varp->begin = 0;
|
||||
|
||||
return varp;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Formerly
|
||||
NC_new_var()
|
||||
*/
|
||||
static NC_var *
|
||||
new_NC_var(const char *uname, nc_type type,
|
||||
size_t ndims, const int *dimids)
|
||||
{
|
||||
NC_string *strp;
|
||||
NC_var *varp;
|
||||
|
||||
char *name = (char *)utf8proc_NFC((const unsigned char *)uname);
|
||||
if(name == NULL)
|
||||
return NULL;
|
||||
strp = new_NC_string(strlen(name), name);
|
||||
free(name);
|
||||
if(strp == NULL)
|
||||
return NULL;
|
||||
|
||||
varp = new_x_NC_var(strp, ndims);
|
||||
if(varp == NULL )
|
||||
{
|
||||
free_NC_string(strp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
varp->type = type;
|
||||
|
||||
if( ndims != 0 && dimids != NULL)
|
||||
(void) memcpy(varp->dimids, dimids, ndims * sizeof(int));
|
||||
|
||||
return(varp);
|
||||
}
|
||||
|
||||
|
||||
static NC_var *
|
||||
dup_NC_var(const NC_var *rvarp)
|
||||
{
|
||||
NC_var *varp = new_NC_var(rvarp->name->cp, rvarp->type,
|
||||
rvarp->ndims, rvarp->dimids);
|
||||
if(varp == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
if(dup_NC_attrarrayV(&varp->attrs, &rvarp->attrs) != NC_NOERR)
|
||||
{
|
||||
free_NC_var(varp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
(void) memcpy(varp->shape, rvarp->shape,
|
||||
rvarp->ndims * sizeof(size_t));
|
||||
(void) memcpy(varp->dsizes, rvarp->dsizes,
|
||||
rvarp->ndims * sizeof(size_t));
|
||||
varp->xsz = rvarp->xsz;
|
||||
varp->len = rvarp->len;
|
||||
varp->begin = rvarp->begin;
|
||||
|
||||
return varp;
|
||||
}
|
||||
|
||||
|
||||
/* vararray */
|
||||
|
||||
|
||||
/*
|
||||
* Free the stuff "in" (referred to by) an NC_vararray.
|
||||
* Leaves the array itself allocated.
|
||||
*/
|
||||
void
|
||||
free_NC_vararrayV0(NC_vararray *ncap)
|
||||
{
|
||||
assert(ncap != NULL);
|
||||
|
||||
if(ncap->nelems == 0)
|
||||
return;
|
||||
|
||||
assert(ncap->value != NULL);
|
||||
|
||||
{
|
||||
NC_var **vpp = ncap->value;
|
||||
NC_var *const *const end = &vpp[ncap->nelems];
|
||||
for( /*NADA*/; vpp < end; vpp++)
|
||||
{
|
||||
free_NC_var(*vpp);
|
||||
*vpp = NULL;
|
||||
}
|
||||
}
|
||||
ncap->nelems = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free NC_vararray values.
|
||||
* formerly
|
||||
NC_free_array()
|
||||
*/
|
||||
void
|
||||
free_NC_vararrayV(NC_vararray *ncap)
|
||||
{
|
||||
assert(ncap != NULL);
|
||||
|
||||
if(ncap->nalloc == 0)
|
||||
return;
|
||||
|
||||
assert(ncap->value != NULL);
|
||||
|
||||
free_NC_vararrayV0(ncap);
|
||||
|
||||
free(ncap->value);
|
||||
ncap->value = NULL;
|
||||
ncap->nalloc = 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
dup_NC_vararrayV(NC_vararray *ncap, const NC_vararray *ref)
|
||||
{
|
||||
int status = NC_NOERR;
|
||||
|
||||
assert(ref != NULL);
|
||||
assert(ncap != NULL);
|
||||
|
||||
if(ref->nelems != 0)
|
||||
{
|
||||
const size_t sz = ref->nelems * sizeof(NC_var *);
|
||||
ncap->value = (NC_var **) malloc(sz);
|
||||
if(ncap->value == NULL)
|
||||
return NC_ENOMEM;
|
||||
(void) memset(ncap->value, 0, sz);
|
||||
ncap->nalloc = ref->nelems;
|
||||
}
|
||||
|
||||
ncap->nelems = 0;
|
||||
{
|
||||
NC_var **vpp = ncap->value;
|
||||
const NC_var **drpp = (const NC_var **)ref->value;
|
||||
NC_var *const *const end = &vpp[ref->nelems];
|
||||
for( /*NADA*/; vpp < end; drpp++, vpp++, ncap->nelems++)
|
||||
{
|
||||
*vpp = dup_NC_var(*drpp);
|
||||
if(*vpp == NULL)
|
||||
{
|
||||
status = NC_ENOMEM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(status != NC_NOERR)
|
||||
{
|
||||
free_NC_vararrayV(ncap);
|
||||
return status;
|
||||
}
|
||||
|
||||
assert(ncap->nelems == ref->nelems);
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add a new handle on the end of an array of handles
|
||||
* Formerly
|
||||
NC_incr_array(array, tail)
|
||||
*/
|
||||
static int
|
||||
incr_NC_vararray(NC_vararray *ncap, NC_var *newelemp)
|
||||
{
|
||||
NC_var **vp;
|
||||
|
||||
assert(ncap != NULL);
|
||||
|
||||
if(ncap->nalloc == 0)
|
||||
{
|
||||
assert(ncap->nelems == 0);
|
||||
vp = (NC_var **) malloc(NC_ARRAY_GROWBY * sizeof(NC_var *));
|
||||
if(vp == NULL)
|
||||
return NC_ENOMEM;
|
||||
ncap->value = vp;
|
||||
ncap->nalloc = NC_ARRAY_GROWBY;
|
||||
}
|
||||
else if(ncap->nelems +1 > ncap->nalloc)
|
||||
{
|
||||
vp = (NC_var **) realloc(ncap->value,
|
||||
(ncap->nalloc + NC_ARRAY_GROWBY) * sizeof(NC_var *));
|
||||
if(vp == NULL)
|
||||
return NC_ENOMEM;
|
||||
ncap->value = vp;
|
||||
ncap->nalloc += NC_ARRAY_GROWBY;
|
||||
}
|
||||
|
||||
if(newelemp != NULL)
|
||||
{
|
||||
ncap->value[ncap->nelems] = newelemp;
|
||||
ncap->nelems++;
|
||||
}
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
|
||||
static NC_var *
|
||||
elem_NC_vararray(const NC_vararray *ncap, size_t elem)
|
||||
{
|
||||
assert(ncap != NULL);
|
||||
/* cast needed for braindead systems with signed size_t */
|
||||
if(ncap->nelems == 0 || (unsigned long)elem >= ncap->nelems)
|
||||
return NULL;
|
||||
|
||||
assert(ncap->value != NULL);
|
||||
|
||||
return ncap->value[elem];
|
||||
}
|
||||
|
||||
|
||||
/* End vararray per se */
|
||||
|
||||
|
||||
/*
|
||||
* Step thru NC_VARIABLE array, seeking match on name.
|
||||
* Return varid or -1 on not found.
|
||||
* *varpp is set to the appropriate NC_var.
|
||||
* Formerly (sort of)
|
||||
NC_hvarid
|
||||
*/
|
||||
int
|
||||
NC_findvar(const NC_vararray *ncap, const char *uname, NC_var **varpp)
|
||||
{
|
||||
NC_var **loc;
|
||||
size_t slen;
|
||||
int varid;
|
||||
char *name;
|
||||
|
||||
assert(ncap != NULL);
|
||||
|
||||
if(ncap->nelems == 0)
|
||||
return -1;
|
||||
|
||||
loc = (NC_var **) ncap->value;
|
||||
|
||||
/* normalized version of uname */
|
||||
name = (char *)utf8proc_NFC((const unsigned char *)uname);
|
||||
if(name == NULL)
|
||||
return NC_ENOMEM;
|
||||
slen = strlen(name);
|
||||
|
||||
for(varid = 0; (size_t) varid < ncap->nelems; varid++, loc++)
|
||||
{
|
||||
if(strlen((*loc)->name->cp) == slen &&
|
||||
strncmp((*loc)->name->cp, name, slen) == 0)
|
||||
{
|
||||
if(varpp != NULL)
|
||||
*varpp = *loc;
|
||||
free(name);
|
||||
return(varid); /* Normal return */
|
||||
}
|
||||
}
|
||||
free(name);
|
||||
return(-1); /* not found */
|
||||
}
|
||||
|
||||
/*
|
||||
* For a netcdf type
|
||||
* return the size of one element in the external representation.
|
||||
* Note that arrays get rounded up to X_ALIGN boundaries.
|
||||
* Formerly
|
||||
NC_xtypelen
|
||||
* See also ncx_len()
|
||||
*/
|
||||
size_t
|
||||
ncx_szof(nc_type type)
|
||||
{
|
||||
switch(type){
|
||||
case NC_BYTE:
|
||||
case NC_CHAR:
|
||||
return(1);
|
||||
case NC_SHORT :
|
||||
return(2);
|
||||
case NC_INT:
|
||||
return X_SIZEOF_INT;
|
||||
case NC_FLOAT:
|
||||
return X_SIZEOF_FLOAT;
|
||||
case NC_DOUBLE :
|
||||
return X_SIZEOF_DOUBLE;
|
||||
default:
|
||||
assert("ncx_szof invalid type" == 0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'compile' the shape and len of a variable
|
||||
* Formerly
|
||||
NC_var_shape(var, dims)
|
||||
*/
|
||||
int
|
||||
NC_var_shape(NC_var *varp, const NC_dimarray *dims)
|
||||
{
|
||||
size_t *shp, *op;
|
||||
off_t *dsp;
|
||||
int *ip;
|
||||
const NC_dim *dimp;
|
||||
off_t product = 1;
|
||||
|
||||
varp->xsz = ncx_szof(varp->type);
|
||||
|
||||
if(varp->ndims == 0)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* use the user supplied dimension indices
|
||||
* to determine the shape
|
||||
*/
|
||||
for(ip = varp->dimids, op = varp->shape
|
||||
; ip < &varp->dimids[varp->ndims]; ip++, op++)
|
||||
{
|
||||
if(*ip < 0 || (size_t) (*ip) >= ((dims != NULL) ? dims->nelems : 1) )
|
||||
return NC_EBADDIM;
|
||||
|
||||
dimp = elem_NC_dimarray(dims, (size_t)*ip);
|
||||
*op = dimp->size;
|
||||
if(*op == NC_UNLIMITED && ip != varp->dimids)
|
||||
return NC_EUNLIMPOS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the dsizes
|
||||
*/
|
||||
/* ndims is > 0 here */
|
||||
for(shp = varp->shape + varp->ndims -1,
|
||||
dsp = varp->dsizes + varp->ndims -1;
|
||||
shp >= varp->shape;
|
||||
shp--, dsp--)
|
||||
{
|
||||
if(!(shp == varp->shape && IS_RECVAR(varp)))
|
||||
{
|
||||
if( ((off_t)(*shp)) <= (X_INT64_MAX / product) )
|
||||
{
|
||||
product *= *shp;
|
||||
} else
|
||||
{
|
||||
product = X_INT64_MAX ;
|
||||
}
|
||||
}
|
||||
*dsp = product;
|
||||
}
|
||||
|
||||
|
||||
out :
|
||||
if( varp->xsz <= (X_UINT_MAX - 1) / product ) /* if integer multiply will not overflow */
|
||||
{
|
||||
varp->len = product * varp->xsz;
|
||||
switch(varp->type) {
|
||||
case NC_BYTE :
|
||||
case NC_CHAR :
|
||||
case NC_SHORT :
|
||||
if( varp->len%4 != 0 )
|
||||
{
|
||||
varp->len += 4 - varp->len%4; /* round up */
|
||||
/* *dsp += 4 - *dsp%4; */
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* already aligned */
|
||||
break;
|
||||
}
|
||||
} else
|
||||
{ /* OK for last var to be "too big", indicated by this special len */
|
||||
varp->len = X_UINT_MAX;
|
||||
}
|
||||
#if 0
|
||||
arrayp("\tshape", varp->ndims, varp->shape);
|
||||
arrayp("\tdsizes", varp->ndims, varp->dsizes);
|
||||
#endif
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether variable size is less than or equal to vlen_max,
|
||||
* without overflowing in arithmetic calculations. If OK, return 1,
|
||||
* else, return 0. For CDF1 format or for CDF2 format on non-LFS
|
||||
* platforms, vlen_max should be 2^31 - 4, but for CDF2 format on
|
||||
* systems with LFS it should be 2^32 - 4.
|
||||
*/
|
||||
int
|
||||
NC_check_vlen(NC_var *varp, size_t vlen_max) {
|
||||
size_t prod=varp->xsz; /* product of xsz and dimensions so far */
|
||||
|
||||
int ii;
|
||||
|
||||
assert(varp != NULL);
|
||||
for(ii = IS_RECVAR(varp) ? 1 : 0; ii < varp->ndims; ii++) {
|
||||
if (varp->shape[ii] > vlen_max / prod) {
|
||||
return 0; /* size in bytes won't fit in a 32-bit int */
|
||||
}
|
||||
prod *= varp->shape[ii];
|
||||
}
|
||||
return 1; /* OK */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Given valid ncp and varid, return var
|
||||
* else NULL on error
|
||||
* Formerly
|
||||
NC_hlookupvar()
|
||||
*/
|
||||
NC_var *
|
||||
NC_lookupvar(NC *ncp, int varid)
|
||||
{
|
||||
NC_var *varp;
|
||||
|
||||
if(varid == NC_GLOBAL)
|
||||
{
|
||||
/* Global is error in this context */
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
|
||||
if(varp == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
assert(varp != NULL);
|
||||
|
||||
return(varp);
|
||||
}
|
||||
|
||||
|
||||
/* Public */
|
||||
|
||||
int
|
||||
nc_def_var( int ncid, const char *name, nc_type type,
|
||||
int ndims, const int *dimids, int *varidp)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
int varid;
|
||||
NC_var *varp;
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
if(!NC_indef(ncp))
|
||||
{
|
||||
return NC_ENOTINDEFINE;
|
||||
}
|
||||
|
||||
status = NC_check_name(name);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
status = nc_cktype(type);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
/* cast needed for braindead systems with signed size_t */
|
||||
if((unsigned long) ndims > X_INT_MAX) /* Backward compat */
|
||||
{
|
||||
return NC_EINVAL;
|
||||
}
|
||||
|
||||
if(ncp->vars.nelems >= NC_MAX_VARS)
|
||||
{
|
||||
return NC_EMAXVARS;
|
||||
}
|
||||
|
||||
varid = NC_findvar(&ncp->vars, name, &varp);
|
||||
if(varid != -1)
|
||||
{
|
||||
return NC_ENAMEINUSE;
|
||||
}
|
||||
|
||||
varp = new_NC_var(name, type, ndims, dimids);
|
||||
if(varp == NULL)
|
||||
return NC_ENOMEM;
|
||||
|
||||
status = NC_var_shape(varp, &ncp->dims);
|
||||
if(status != NC_NOERR)
|
||||
{
|
||||
free_NC_var(varp);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = incr_NC_vararray(&ncp->vars, varp);
|
||||
if(status != NC_NOERR)
|
||||
{
|
||||
free_NC_var(varp);
|
||||
return status;
|
||||
}
|
||||
|
||||
if(varidp != NULL)
|
||||
*varidp = (int)ncp->vars.nelems -1; /* varid */
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nc_inq_varid(int ncid, const char *name, int *varid_ptr)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
NC_var *varp;
|
||||
int varid;
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
varid = NC_findvar(&ncp->vars, name, &varp);
|
||||
if(varid == -1)
|
||||
{
|
||||
return NC_ENOTVAR;
|
||||
}
|
||||
|
||||
*varid_ptr = varid;
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nc_inq_var(int ncid,
|
||||
int varid,
|
||||
char *name,
|
||||
nc_type *typep,
|
||||
int *ndimsp,
|
||||
int *dimids,
|
||||
int *nattsp)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
NC_var *varp;
|
||||
size_t ii;
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
|
||||
if(varp == NULL)
|
||||
return NC_ENOTVAR;
|
||||
|
||||
if(name != NULL)
|
||||
{
|
||||
(void) strncpy(name, varp->name->cp, varp->name->nchars);
|
||||
name[varp->name->nchars] = 0;
|
||||
}
|
||||
|
||||
if(typep != 0)
|
||||
*typep = varp->type;
|
||||
if(ndimsp != 0)
|
||||
{
|
||||
*ndimsp = (int) varp->ndims;
|
||||
}
|
||||
if(dimids != 0)
|
||||
{
|
||||
for(ii = 0; ii < varp->ndims; ii++)
|
||||
{
|
||||
dimids[ii] = varp->dimids[ii];
|
||||
}
|
||||
}
|
||||
if(nattsp != 0)
|
||||
{
|
||||
*nattsp = (int) varp->attrs.nelems;
|
||||
}
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_varname(int ncid, int varid, char *name)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
NC_var *varp;
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
|
||||
if(varp == NULL)
|
||||
return NC_ENOTVAR;
|
||||
|
||||
if(name != NULL)
|
||||
{
|
||||
(void) strncpy(name, varp->name->cp, varp->name->nchars);
|
||||
name[varp->name->nchars] = 0;
|
||||
}
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_vartype(int ncid, int varid, nc_type *typep)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
NC_var *varp;
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
|
||||
if(varp == NULL)
|
||||
return NC_ENOTVAR;
|
||||
|
||||
if(typep != 0)
|
||||
*typep = varp->type;
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_inq_varndims(int ncid, int varid, int *ndimsp)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
NC_var *varp;
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
|
||||
if(varp == NULL)
|
||||
return NC_ENOTVAR; /* TODO: is this the right error code? */
|
||||
|
||||
if(ndimsp != 0)
|
||||
{
|
||||
*ndimsp = (int) varp->ndims;
|
||||
}
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nc_inq_vardimid(int ncid, int varid, int *dimids)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
NC_var *varp;
|
||||
size_t ii;
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
|
||||
if(varp == NULL)
|
||||
return NC_ENOTVAR; /* TODO: is this the right error code? */
|
||||
|
||||
if(dimids != 0)
|
||||
{
|
||||
for(ii = 0; ii < varp->ndims; ii++)
|
||||
{
|
||||
dimids[ii] = varp->dimids[ii];
|
||||
}
|
||||
}
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nc_inq_varnatts(int ncid, int varid, int *nattsp)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
NC_var *varp;
|
||||
|
||||
if(varid == NC_GLOBAL)
|
||||
return nc_inq_natts(ncid, nattsp);
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
|
||||
if(varp == NULL)
|
||||
return NC_ENOTVAR; /* TODO: is this the right error code? */
|
||||
|
||||
if(nattsp != 0)
|
||||
{
|
||||
*nattsp = (int) varp->attrs.nelems;
|
||||
}
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
int
|
||||
nc_rename_var(int ncid, int varid, const char *unewname)
|
||||
{
|
||||
int status;
|
||||
NC *ncp;
|
||||
NC_var *varp;
|
||||
NC_string *old, *newStr;
|
||||
int other;
|
||||
char *newname; /* normalized */
|
||||
|
||||
status = NC_check_id(ncid, &ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
if(NC_readonly(ncp))
|
||||
{
|
||||
return NC_EPERM;
|
||||
}
|
||||
|
||||
status = NC_check_name(unewname);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
/* check for name in use */
|
||||
other = NC_findvar(&ncp->vars, unewname, &varp);
|
||||
if(other != -1)
|
||||
{
|
||||
return NC_ENAMEINUSE;
|
||||
}
|
||||
|
||||
varp = NC_lookupvar(ncp, varid);
|
||||
if(varp == NULL)
|
||||
{
|
||||
/* invalid varid */
|
||||
return NC_ENOTVAR; /* TODO: is this the right error code? */
|
||||
}
|
||||
|
||||
old = varp->name;
|
||||
newname = (char *)utf8proc_NFC((const unsigned char *)unewname);
|
||||
if(newname == NULL)
|
||||
return NC_ENOMEM;
|
||||
if(NC_indef(ncp))
|
||||
{
|
||||
newStr = new_NC_string(strlen(newname),newname);
|
||||
free(newname);
|
||||
if(newStr == NULL)
|
||||
return(-1);
|
||||
varp->name = newStr;
|
||||
free_NC_string(old);
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/* else, not in define mode */
|
||||
status = set_NC_string(varp->name, newname);
|
||||
free(newname);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
|
||||
set_NC_hdirty(ncp);
|
||||
|
||||
if(NC_doHsync(ncp))
|
||||
{
|
||||
status = NC_sync(ncp);
|
||||
if(status != NC_NOERR)
|
||||
return status;
|
||||
}
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
@ -31,24 +31,26 @@ libnetcdf4_la_SOURCES = ${NC4SOURCES}
|
||||
# and various other things
|
||||
LDADD += stub4.lo ${top_builddir}/libsrc4/libnetcdf4.la \
|
||||
${top_builddir}/libsrc/libnetcdf3.la \
|
||||
${top_builddir}/libdispatch/libnetcdf2.la \
|
||||
${top_builddir}/libdispatch/libdispatch.la
|
||||
|
||||
if USE_DAP
|
||||
LDADD += ${top_builddir}/oc/liboc.la
|
||||
endif
|
||||
if BUILD_V2
|
||||
LDADD += ${top_builddir}/libdispatch/libnetcdf2.la
|
||||
endif
|
||||
|
||||
NC4_TESTS = tst_h_files tst_h_files2 tst_h_atts tst_h_atts2 \
|
||||
NC4_TESTS = tst_h_files tst_h_files2 tst_h_atts tst_h_atts2 \
|
||||
tst_h_atts3 tst_h_vars tst_h_vars2 tst_h_vars3 tst_h_grps \
|
||||
tst_h_compounds tst_h_compounds2 tst_h_wrt_cmp tst_h_rd_cmp tst_h_vl \
|
||||
tst_h_opaques tst_h_strings tst_h_strings1 tst_h_dimscales \
|
||||
tst_h_dimscales1 tst_h_dimscales2 tst_h_dimscales3 tst_h_enums \
|
||||
tst_h_vl2 tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars \
|
||||
tst_varms tst_unlim_vars tst_atts tst_atts2 tst_converts tst_converts2 \
|
||||
tst_grps tst_compounds tst_compounds2 tst_compounds3 tst_vl \
|
||||
tst_opaques tst_strings tst_interops tst_interops4 tst_interops5 \
|
||||
tst_enums tst_vars2 tst_coords tst_coords2 tst_coords3 tst_vars3 \
|
||||
tst_chunks tst_utf8 tst_fills tst_fillbug $(TST_V2) tst_xplatform \
|
||||
tst_xplatform2 tst_endian_fill
|
||||
tst_varms tst_unlim_vars tst_converts tst_converts2 tst_grps \
|
||||
tst_compounds tst_compounds2 tst_compounds3 tst_opaques tst_strings \
|
||||
tst_interops tst_interops4 tst_interops5 tst_enums tst_coords \
|
||||
tst_coords2 tst_coords3 tst_vars3 tst_chunks tst_utf8 tst_fills \
|
||||
tst_fillbug tst_xplatform tst_xplatform2 tst_endian_fill
|
||||
|
||||
check_PROGRAMS = $(NC4_TESTS)
|
||||
if LARGE_FILE_TESTS
|
||||
@ -62,21 +64,10 @@ endif
|
||||
|
||||
TESTS = $(NC4_TESTS)
|
||||
|
||||
if USE_HDF4
|
||||
check_PROGRAMS += tst_interops2
|
||||
TESTS += tst_interops2
|
||||
if USE_HDF4_FILE_TESTS
|
||||
check_PROGRAMS += tst_interops3
|
||||
TESTS += run_get_hdf4_files.sh tst_interops3
|
||||
endif # USE_HDF4_FILE_TESTS
|
||||
tst_interops2_LDADD = ${lib_LTLIBRARIES} -lmfhdf -ldf -ljpeg -lhdf5_hl -lhdf5 -lz
|
||||
endif # USE_HDF4
|
||||
|
||||
EXTRA_DIST = ref_tst_compounds.nc ref_tst_h_compounds.h5 \
|
||||
ref_tst_h_compounds2.h5 run_par_tests.sh run_valgrind_tests.sh \
|
||||
run_hdf4_valgrind_tests.sh ref_tst_xplatform2_1.nc \
|
||||
ref_tst_xplatform2_2.nc ref_tst_dims.nc run_get_hdf4_files.sh \
|
||||
ref_tst_interops4.nc stub4.c
|
||||
EXTRA_DIST = ref_tst_compounds.nc ref_tst_h_compounds.h5 \
|
||||
ref_tst_h_compounds2.h5 run_par_tests.sh run_valgrind_tests.sh \
|
||||
run_hdf4_valgrind_tests.sh ref_tst_xplatform2_1.nc \
|
||||
ref_tst_xplatform2_2.nc ref_tst_dims.nc ref_tst_interops4.nc stub4.c
|
||||
|
||||
# These linker flags will be applied to all test program compiles.
|
||||
LDADD += ${lib_LTLIBRARIES}
|
||||
@ -117,12 +108,4 @@ endif # USE_VALGRIND_TESTS
|
||||
CLEANFILES = tst_nc_converts.nc tst_h_*.h5 tst_*.nc tst_interops*.h5 \
|
||||
tst_interops2.h4 tst_interops4.nc AMSR_E_* MYD29.A2*
|
||||
|
||||
if USE_HDF4_FILE_TESTS
|
||||
DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf \
|
||||
AMSR_E_L3_DailyLand_V06_20020619.hdf \
|
||||
MYD29.A2009152.0000.005.2009153124331.hdf \
|
||||
MYD29.A2002185.0000.005.2007160150627.hdf \
|
||||
MOD29.A2000055.0005.005.2006267200024.hdf
|
||||
endif # HDF4_FILE_TESTS
|
||||
|
||||
test: check
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
Copyright 2003, University Corporation for Atmospheric Research. See
|
||||
COPYRIGHT file for copying and redistribution conditions.
|
||||
|
||||
$Id: nc4file.c,v 1.165 2010/06/01 15:34:51 ed Exp $
|
||||
*/
|
||||
|
||||
#include "nc4internal.h"
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include "error.h"
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -22,6 +22,7 @@ has_dap="@HAS_DAP@"
|
||||
has_nc2="@HAS_NC2@"
|
||||
has_nc4="@HAS_NC4@"
|
||||
has_hdf4="@HAS_HDF4@"
|
||||
has_pnetcdf="@HAS_PNETCDF@"
|
||||
has_hdf5="@HAS_HDF5@"
|
||||
has_f77="@HAS_F77@"
|
||||
has_f90="@HAS_F90@"
|
||||
@ -48,6 +49,7 @@ Available values for OPTION include:
|
||||
--has-nc4 whether NetCDF-4/HDF-5 is enabled in this build
|
||||
--has-hdf5 whether HDF5 is used in build (always the same as --has-nc4)
|
||||
--has-hdf4 whether HDF4 was used in build
|
||||
--has-pnetcdf whether parallel-netcdf (a.k.a. pnetcdf) was used in build
|
||||
--has-f77 whether Fortran 77 API is enabled in this build
|
||||
--has-f90 whether Fortran 90 API is enabled in this build
|
||||
--has-c++ whether C++ API is enabled in this build
|
||||
@ -86,6 +88,7 @@ all()
|
||||
echo " --has-nc4 -> $has_nc4"
|
||||
echo " --has-hdf5 -> $has_hdf5"
|
||||
echo " --has-hdf4 -> $has_hdf4"
|
||||
echo " --has-pnetcdf-> $has_pnetcdf"
|
||||
echo " --has-szlib -> $has_szlib"
|
||||
echo
|
||||
echo " --prefix -> $prefix"
|
||||
@ -161,6 +164,10 @@ while test $# -gt 0; do
|
||||
echo $has_hdf4
|
||||
;;
|
||||
|
||||
--has-pnetcdf)
|
||||
echo $has_pnetcdf
|
||||
;;
|
||||
|
||||
--has-hdf5)
|
||||
echo $has_hdf5
|
||||
;;
|
||||
|
@ -11,10 +11,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
# These files are created by the tests.
|
||||
CLEANFILES = nc_test_classic.nc nc_test_64bit.nc nc_test_netcdf4.nc \
|
||||
tst_*.nc
|
||||
tst_*.nc t_nc.nc large_files.nc quick_large_files.nc
|
||||
|
||||
# These are the tests which are always run.
|
||||
TESTPROGRAMS = tst_small nc_test tst_misc tst_norm tst_names
|
||||
TESTPROGRAMS = t_nc tst_small nc_test tst_misc tst_norm tst_names
|
||||
|
||||
# These are the source files for the main workhorse test program,
|
||||
# nc_test. If you pass nc_test, you are doing well.
|
||||
@ -26,10 +26,8 @@ AM_CPPFLAGS += -I$(top_builddir)/liblib
|
||||
|
||||
# If the user asked for large file tests, then add them.
|
||||
if LARGE_FILE_TESTS
|
||||
TESTPROGRAMS += quick_large_files tst_big_var6 tst_big_var2 tst_big_rvar tst_big_var \
|
||||
tst_large large_files
|
||||
CLEANFILES += large_files.nc quick_large_files.nc tst_big_var.nc \
|
||||
tst_big_var2.nc tst_big_rvar.nc
|
||||
TESTPROGRAMS += quick_large_files tst_big_var6 tst_big_var2 \
|
||||
tst_big_rvar tst_big_var tst_large large_files
|
||||
endif # LARGE_FILE_TESTS
|
||||
|
||||
# Set up the tests.
|
||||
@ -48,4 +46,3 @@ MAINTAINERCLEANFILES = test_get.c test_put.c
|
||||
.m4.c:
|
||||
m4 $(AM_M4FLAGS) $(M4FLAGS) $< >$@
|
||||
|
||||
test: check
|
||||
|
@ -1,20 +1,15 @@
|
||||
/*
|
||||
* Copyright 1988 University Corporation for Atmospheric Research
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
*/
|
||||
/* $Id: t_nc.c,v 1.94 2010/05/27 21:34:13 dmh Exp $ */
|
||||
|
||||
/*
|
||||
* Program to create a cdf, exercise all cdf functions.
|
||||
* Creates cdf, stuff it full of numbers, closes it. Then
|
||||
* reopens it, and checks for consistency.
|
||||
* Leaves the file around afterwards.
|
||||
*
|
||||
* Based on a program to test the nasa look-alike program,
|
||||
* so not the most appropropriate test. See ../nctest for a
|
||||
* complete spec test.
|
||||
*/
|
||||
/* Copyright 1988-2010 University Corporation for Atmospheric Research
|
||||
See netcdf/COPYRIGHT file for copying and redistribution
|
||||
conditions.
|
||||
|
||||
Program to create a cdf, exercise all cdf functions. Creates cdf,
|
||||
stuff it full of numbers, closes it. Then reopens it, and checks
|
||||
for consistency. Leaves the file around afterwards.
|
||||
|
||||
Based on a program to test the nasa look-alike program, so not the
|
||||
most appropropriate test. See ../nctest for a complete spec test.
|
||||
|
||||
$Id: t_nc.c,v 1.94 2010/05/27 21:34:13 dmh Exp $ */
|
||||
|
||||
#define REDEF
|
||||
/* #define SYNCDEBUG */
|
||||
@ -28,16 +23,13 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <netcdf.h>
|
||||
#ifndef USE_DISPATCH
|
||||
#include "rename.h"
|
||||
#endif
|
||||
|
||||
#define MAXSHORT 32767
|
||||
#define MAXINT 2147483647
|
||||
#define MAXBYTE 127
|
||||
|
||||
|
||||
#define FNAME "test.nc"
|
||||
#define FNAME "t_nc.nc"
|
||||
#define NUM_DIMS 3
|
||||
#define DONT_CARE -1
|
||||
/* make these numbers big when you want to give this a real workout */
|
||||
@ -76,6 +68,10 @@ union getret
|
||||
};
|
||||
|
||||
|
||||
#ifdef USE_NETCDF4
|
||||
const char *nc3_strerror(int ncerr);
|
||||
#endif
|
||||
|
||||
static void
|
||||
chkgot(nc_type type, union getret got, double check)
|
||||
{
|
||||
@ -470,8 +466,13 @@ main(int ac, char *av[])
|
||||
ret = nc__open(fname,NC_NOWRITE, &chunksz, &id);
|
||||
if(ret != NC_NOERR)
|
||||
{
|
||||
#ifdef USE_NETCDF4
|
||||
(void) printf("Could not open %s: %s\n", fname,
|
||||
nc3_strerror(ret));
|
||||
#else
|
||||
(void) printf("Could not open %s: %s\n", fname,
|
||||
nc_strerror(ret));
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
(void) printf("reopen id = %d for filename %s\n",
|
@ -7,8 +7,6 @@
|
||||
#
|
||||
# $Id: Makefile.am,v 1.72 2010/05/29 00:44:02 dmh Exp $
|
||||
|
||||
if USE_NETCDF4
|
||||
|
||||
AM_LDFLAGS = ${top_builddir}/liblib/libnetcdf.la @EXTERN_LDFLAGS@
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/liblib @EXTERN_CFLAGS@
|
||||
|
||||
@ -16,10 +14,16 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/liblib @EXTERN_CFLAGS@
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/libsrc4 -I$(top_srcdir)/libsrc
|
||||
|
||||
# Our test programs and sources...
|
||||
check_PROGRAMS = cdm_sea_soundings tst_camrun
|
||||
NC4_TEST_PROGS = t_type cdm_sea_soundings tst_camrun tst_vl tst_atts \
|
||||
tst_atts2 tst_vars2 tst_v2
|
||||
cdm_sea_soundings_SOURCES = cdm_sea_soundings.c tests.h
|
||||
tst_camrun_SOURCES = tst_camrun.c tests.h
|
||||
TESTS = cdm_sea_soundings tst_camrun
|
||||
check_PROGRAMS = $(NC4_TEST_PROGS)
|
||||
TESTS = $(NC4_TEST_PROGS)
|
||||
|
||||
#if BUILD_V2
|
||||
#TESTS += tst_v2
|
||||
#endif # BUILD_V2
|
||||
|
||||
if LARGE_FILE_TESTS
|
||||
tst_large_SOURCES = tst_large.c tests.h
|
||||
@ -47,15 +51,24 @@ benchmarks: check
|
||||
./run_bm_ar4.sh
|
||||
endif # BUILD_BENCHMARKS
|
||||
|
||||
CLEANFILES = cdm_sea_soundings.nc tst_large.nc bm_chunking.nc \
|
||||
bm_radar.nc bm_radar1.nc radar_3d_compression_test.txt \
|
||||
radar_3d_compression.txt radar_2d_compression.txt \
|
||||
radar_3d_chunking.txt tst_floats_1D.nc tst_floats_1D.cdl \
|
||||
floats_1D_3.nc floats_1D.cdl tst_floats2_*.nc tst_ints2_*.nc \
|
||||
tst_shorts2_*.nc tst_elena_*.nc tst_simple*.nc tst_floats2_*.cdl \
|
||||
# These are the tests for HDF4.
|
||||
if USE_HDF4
|
||||
check_PROGRAMS += tst_interops2
|
||||
TESTS += tst_interops2
|
||||
if USE_HDF4_FILE_TESTS
|
||||
check_PROGRAMS += tst_interops3
|
||||
TESTS += run_get_hdf4_files.sh tst_interops3
|
||||
endif # USE_HDF4_FILE_TESTS
|
||||
tst_interops2_LDADD = ${lib_LTLIBRARIES} -lmfhdf -ldf -ljpeg -lhdf5_hl \
|
||||
-lhdf5 -lz
|
||||
endif # USE_HDF4
|
||||
|
||||
CLEANFILES = cdm_sea_soundings.nc bm_chunking.nc bm_radar.nc \
|
||||
bm_radar1.nc radar_3d_compression_test.txt radar_3d_compression.txt \
|
||||
radar_2d_compression.txt radar_3d_chunking.txt tst_floats_1D.cdl \
|
||||
floats_1D_3.nc floats_1D.cdl tst_*.nc tst_floats2_*.cdl \
|
||||
tst_ints2_*.cdl tst_shorts2_*.cdl tst_elena_*.cdl tst_simple*.cdl \
|
||||
tst_chunks.nc tst_chunks.cdl pr_A1.* tauu_A1.* usi_01.* thetau_01.* \
|
||||
tst_camrun.nc
|
||||
tst_chunks.cdl pr_A1.* tauu_A1.* usi_01.* thetau_01.*
|
||||
|
||||
# This are extra tests that will only be run if netcdf-4 is configured
|
||||
# with --enable-parallel-tests.
|
||||
@ -73,9 +86,17 @@ endif
|
||||
|
||||
EXTRA_DIST = run_par_test.sh run_bm.sh run_bm_test1.sh run_bm_test2.sh \
|
||||
run_bm_radar_2D.sh run_bm_radar_2D_compression1.sh run_par_bm_test.sh \
|
||||
run_bm_elena.sh run_par_bm_radar_2D.sh run_bm_radar_2D_endianness1.sh \
|
||||
run_tst_chunks.sh ref_chunks1.cdl ref_chunks2.cdl run_pnetcdf_test.sh
|
||||
run_bm_elena.sh run_par_bm_radar_2D.sh run_bm_radar_2D_endianness1.sh \
|
||||
run_tst_chunks.sh ref_chunks1.cdl ref_chunks2.cdl run_pnetcdf_test.sh \
|
||||
run_get_hdf4_files.sh
|
||||
|
||||
if USE_HDF4_FILE_TESTS
|
||||
DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf \
|
||||
AMSR_E_L3_DailyLand_V06_20020619.hdf \
|
||||
MYD29.A2009152.0000.005.2009153124331.hdf \
|
||||
MYD29.A2002185.0000.005.2007160150627.hdf \
|
||||
MOD29.A2000055.0005.005.2006267200024.hdf
|
||||
endif # HDF4_FILE_TESTS
|
||||
|
||||
endif # BUILD_NETCDF4
|
||||
|
||||
|
||||
|
@ -7,27 +7,15 @@
|
||||
$Id: t_type.c,v 2.3 2010/05/26 21:43:33 dmh Exp $
|
||||
*/
|
||||
|
||||
/* #define SYNCDEBUG */
|
||||
|
||||
#include <config.h>
|
||||
#include <nc_tests.h>
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#ifndef USE_DISPATCH
|
||||
#include "rename.h"
|
||||
#endif
|
||||
#include <netcdf.h>
|
||||
|
||||
/* This macro prints an error message with line number and name of
|
||||
* test program. */
|
||||
#define ERR do { \
|
||||
fflush(stdout); /* Make sure our stdout is synced with stderr. */ \
|
||||
fprintf(stderr, "Sorry! Unexpected result, %s, line: %d\n", \
|
||||
__FILE__, __LINE__); \
|
||||
} while (0)
|
||||
|
||||
int
|
||||
main(int ac, char *av[])
|
||||
{
|
||||
@ -38,7 +26,7 @@ main(int ac, char *av[])
|
||||
|
||||
printf("\n *** Testing netCDF classic version of nc_inq_type...");
|
||||
if (nc_inq_type(ncid, 0, name_in, &size_in) != NC_EBADTYPE) ERR;
|
||||
if (nc_inq_type(ncid, NC_DOUBLE + 1, name_in, &size_in) != NC_EBADTYPE) ERR;
|
||||
if (nc_inq_type(ncid, NC_STRING + 1, name_in, &size_in) != NC_EBADTYPE) ERR;
|
||||
if (nc_inq_type(ncid, NC_BYTE, name_in, &size_in)) ERR;
|
||||
if (strcmp(name_in, "byte") || size_in != 1) ERR;
|
||||
if (nc_inq_type(ncid, NC_CHAR, name_in, &size_in)) ERR;
|
||||
@ -51,7 +39,6 @@ main(int ac, char *av[])
|
||||
if (strcmp(name_in, "float") || size_in != 4) ERR;
|
||||
if (nc_inq_type(ncid, NC_DOUBLE, name_in, &size_in)) ERR;
|
||||
if (strcmp(name_in, "double") || size_in != 8) ERR;
|
||||
printf(" OK!\n");
|
||||
|
||||
return 0;
|
||||
SUMMARIZE_ERR;
|
||||
FINAL_RESULTS;
|
||||
}
|
@ -662,6 +662,7 @@
|
||||
# define RANK_wat_a3 4
|
||||
|
||||
#ifdef EXTRA_TESTS
|
||||
#define MEGABYTE 1048576
|
||||
void
|
||||
get_mem_used2(int *mem_used)
|
||||
{
|
||||
|
@ -8,6 +8,7 @@
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <nc_tests.h>
|
||||
#include <hdf5.h>
|
||||
#include <H5DSpublic.h>
|
||||
#include <mfhdf.h>
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
# $Id: Makefile.am,v 1.54 2010/05/29 00:42:11 dmh Exp $
|
||||
|
||||
AM_LDFLAGS =
|
||||
AM_CPPFLAGS =
|
||||
AM_LDFLAGS = @EXTERN_LDFLAGS@
|
||||
AM_CPPFLAGS = -I${top_srcdir} @EXTERN_CFLAGS@
|
||||
LDADD =
|
||||
|
||||
LDADD += ${top_builddir}/liblib/libnetcdf.la @EXTERN_LDFLAGS@
|
||||
|
@ -36,4 +36,3 @@ tests.h val.c val.h vardef.c varget.c vargetg.c varput.c varputg.c \
|
||||
vartests.c vputget.c vputgetg.c
|
||||
|
||||
# For those who can't remember to type make check instead of make test.
|
||||
test: check
|
||||
|
@ -20,7 +20,7 @@
|
||||
LDADD =
|
||||
AM_LDFLAGS =
|
||||
AM_CFLAGS =
|
||||
AM_CPPFLAGS =
|
||||
AM_CPPFLAGS = -I$(top_srcdir)
|
||||
AM_FFLAGS =
|
||||
AM_FCFLAGS =
|
||||
TESTS =
|
||||
|
@ -8,7 +8,7 @@
|
||||
# $Id: Makefile.am,v 1.1 2010/05/23 21:05:33 dmh Exp $
|
||||
|
||||
# Cause C preprocessor to search current and parent directory.
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/libsrc
|
||||
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libsrc
|
||||
|
||||
# Linker needs to search current directory when building tests.
|
||||
AM_LDFLAGS =
|
||||
|
@ -1,22 +1,24 @@
|
||||
/* A Bison parser, made by GNU Bison 2.4.2. */
|
||||
/* A Bison parser, made by GNU Bison 2.3. */
|
||||
|
||||
/* Skeleton implementation for Bison's Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
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.
|
||||
|
||||
the Free Software Foundation; either version 2, 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/>. */
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
@ -27,7 +29,7 @@
|
||||
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. */
|
||||
|
||||
@ -45,7 +47,7 @@
|
||||
#define YYBISON 1
|
||||
|
||||
/* Bison version. */
|
||||
#define YYBISON_VERSION "2.4.2"
|
||||
#define YYBISON_VERSION "2.3"
|
||||
|
||||
/* Skeleton name. */
|
||||
#define YYSKELETON_NAME "yacc.c"
|
||||
@ -53,28 +55,57 @@
|
||||
/* Pure parsers. */
|
||||
#define YYPURE 0
|
||||
|
||||
/* Push parsers. */
|
||||
#define YYPUSH 0
|
||||
|
||||
/* Pull parsers. */
|
||||
#define YYPULL 1
|
||||
|
||||
/* Using locations. */
|
||||
#define YYLSP_NEEDED 0
|
||||
|
||||
/* Substitute the variable and function names. */
|
||||
#define yyparse utparse
|
||||
#define yylex utlex
|
||||
#define yyerror uterror
|
||||
#define yylval utlval
|
||||
#define yychar utchar
|
||||
#define yydebug utdebug
|
||||
#define yynerrs utnerrs
|
||||
#define yyparse utparse
|
||||
#define yylex utlex
|
||||
#define yyerror uterror
|
||||
#define yylval utlval
|
||||
#define yychar utchar
|
||||
#define yydebug utdebug
|
||||
#define yynerrs utnerrs
|
||||
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
ERR = 258,
|
||||
SHIFT = 259,
|
||||
MULTIPLY = 260,
|
||||
DIVIDE = 261,
|
||||
INT = 262,
|
||||
EXPONENT = 263,
|
||||
REAL = 264,
|
||||
ID = 265,
|
||||
DATE = 266,
|
||||
CLOCK = 267,
|
||||
TIMESTAMP = 268,
|
||||
LOGREF = 269
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define ERR 258
|
||||
#define SHIFT 259
|
||||
#define MULTIPLY 260
|
||||
#define DIVIDE 261
|
||||
#define INT 262
|
||||
#define EXPONENT 263
|
||||
#define REAL 264
|
||||
#define ID 265
|
||||
#define DATE 266
|
||||
#define CLOCK 267
|
||||
#define TIMESTAMP 268
|
||||
#define LOGREF 269
|
||||
|
||||
|
||||
|
||||
|
||||
/* Copy the first part of user declarations. */
|
||||
|
||||
/* Line 189 of yacc.c */
|
||||
#line 1 "parser.y"
|
||||
|
||||
/*
|
||||
@ -178,9 +209,6 @@ uterror(
|
||||
}
|
||||
|
||||
|
||||
/* Line 189 of yacc.c */
|
||||
#line 183 "parser.c"
|
||||
|
||||
/* Enabling traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 1
|
||||
@ -199,72 +227,30 @@ uterror(
|
||||
# define YYTOKEN_TABLE 0
|
||||
#endif
|
||||
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
ERR = 258,
|
||||
SHIFT = 259,
|
||||
MULTIPLY = 260,
|
||||
DIVIDE = 261,
|
||||
INT = 262,
|
||||
EXPONENT = 263,
|
||||
REAL = 264,
|
||||
ID = 265,
|
||||
DATE = 266,
|
||||
CLOCK = 267,
|
||||
TIMESTAMP = 268,
|
||||
LOGREF = 269
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define ERR 258
|
||||
#define SHIFT 259
|
||||
#define MULTIPLY 260
|
||||
#define DIVIDE 261
|
||||
#define INT 262
|
||||
#define EXPONENT 263
|
||||
#define REAL 264
|
||||
#define ID 265
|
||||
#define DATE 266
|
||||
#define CLOCK 267
|
||||
#define TIMESTAMP 268
|
||||
#define LOGREF 269
|
||||
|
||||
|
||||
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
{
|
||||
|
||||
/* Line 214 of yacc.c */
|
||||
#line 103 "parser.y"
|
||||
|
||||
{
|
||||
char* id; /* identifier */
|
||||
ut_unit* unit; /* "unit" structure */
|
||||
double rval; /* floating-point numerical value */
|
||||
long ival; /* integer numerical value */
|
||||
|
||||
|
||||
|
||||
/* Line 214 of yacc.c */
|
||||
#line 256 "parser.c"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
}
|
||||
/* Line 187 of yacc.c. */
|
||||
#line 241 "parser.c"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Copy the second part of user declarations. */
|
||||
|
||||
|
||||
/* Line 264 of yacc.c */
|
||||
#line 268 "parser.c"
|
||||
/* Line 216 of yacc.c. */
|
||||
#line 254 "parser.c"
|
||||
|
||||
#ifdef short
|
||||
# undef short
|
||||
@ -314,7 +300,7 @@ typedef short int yytype_int16;
|
||||
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
|
||||
|
||||
#ifndef YY_
|
||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
||||
# if YYENABLE_NLS
|
||||
# if ENABLE_NLS
|
||||
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
||||
@ -339,14 +325,14 @@ typedef short int yytype_int16;
|
||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||
|| defined __cplusplus || defined _MSC_VER)
|
||||
static int
|
||||
YYID (int yyi)
|
||||
YYID (int i)
|
||||
#else
|
||||
static int
|
||||
YYID (yyi)
|
||||
int yyi;
|
||||
YYID (i)
|
||||
int i;
|
||||
#endif
|
||||
{
|
||||
return yyi;
|
||||
return i;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -427,9 +413,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
|
||||
/* A type that is properly aligned for any stack member. */
|
||||
union yyalloc
|
||||
{
|
||||
yytype_int16 yyss_alloc;
|
||||
YYSTYPE yyvs_alloc;
|
||||
};
|
||||
yytype_int16 yyss;
|
||||
YYSTYPE yyvs;
|
||||
};
|
||||
|
||||
/* The size of the maximum gap between one aligned stack and the next. */
|
||||
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
|
||||
@ -463,12 +449,12 @@ union yyalloc
|
||||
elements in the stack, and YYPTR gives the new location of the
|
||||
stack. Advance YYPTR to a properly aligned location for the next
|
||||
stack. */
|
||||
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
|
||||
# define YYSTACK_RELOCATE(Stack) \
|
||||
do \
|
||||
{ \
|
||||
YYSIZE_T yynewbytes; \
|
||||
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
|
||||
Stack = &yyptr->Stack_alloc; \
|
||||
YYCOPY (&yyptr->Stack, Stack, yysize); \
|
||||
Stack = &yyptr->Stack; \
|
||||
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
||||
yyptr += yynewbytes / sizeof (*yyptr); \
|
||||
} \
|
||||
@ -685,18 +671,9 @@ static const yytype_uint8 yystos[] =
|
||||
|
||||
/* Like YYERROR except do call yyerror. This remains here temporarily
|
||||
to ease the transition to the new meaning of YYERROR, for GCC.
|
||||
Once GCC version 2 has supplanted version 1, this can go. However,
|
||||
YYFAIL appears to be in use. Nevertheless, it is formally deprecated
|
||||
in Bison 2.4.2's NEWS entry, where a plan to phase it out is
|
||||
discussed. */
|
||||
Once GCC version 2 has supplanted version 1, this can go. */
|
||||
|
||||
#define YYFAIL goto yyerrlab
|
||||
#if defined YYFAIL
|
||||
/* This is here to suppress warnings from the GCC cpp's
|
||||
-Wunused-macros. Normally we don't worry about that warning, but
|
||||
some users do, and we want to make it easy for users to remove
|
||||
YYFAIL uses, which will produce warnings from Bison 2.5. */
|
||||
#endif
|
||||
|
||||
#define YYRECOVERING() (!!yyerrstatus)
|
||||
|
||||
@ -753,7 +730,7 @@ while (YYID (0))
|
||||
we won't break user code: when these are the locations we know. */
|
||||
|
||||
#ifndef YY_LOCATION_PRINT
|
||||
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
|
||||
# if YYLTYPE_IS_TRIVIAL
|
||||
# define YY_LOCATION_PRINT(File, Loc) \
|
||||
fprintf (File, "%d.%d-%d.%d", \
|
||||
(Loc).first_line, (Loc).first_column, \
|
||||
@ -864,20 +841,17 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
|
||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||
|| defined __cplusplus || defined _MSC_VER)
|
||||
static void
|
||||
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
|
||||
yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
|
||||
#else
|
||||
static void
|
||||
yy_stack_print (yybottom, yytop)
|
||||
yytype_int16 *yybottom;
|
||||
yytype_int16 *yytop;
|
||||
yy_stack_print (bottom, top)
|
||||
yytype_int16 *bottom;
|
||||
yytype_int16 *top;
|
||||
#endif
|
||||
{
|
||||
YYFPRINTF (stderr, "Stack now");
|
||||
for (; yybottom <= yytop; yybottom++)
|
||||
{
|
||||
int yybot = *yybottom;
|
||||
YYFPRINTF (stderr, " %d", yybot);
|
||||
}
|
||||
for (; bottom <= top; ++bottom)
|
||||
YYFPRINTF (stderr, " %d", *bottom);
|
||||
YYFPRINTF (stderr, "\n");
|
||||
}
|
||||
|
||||
@ -911,11 +885,11 @@ yy_reduce_print (yyvsp, yyrule)
|
||||
/* The symbols being reduced. */
|
||||
for (yyi = 0; yyi < yynrhs; yyi++)
|
||||
{
|
||||
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
||||
fprintf (stderr, " $%d = ", yyi + 1);
|
||||
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
|
||||
&(yyvsp[(yyi + 1) - (yynrhs)])
|
||||
);
|
||||
YYFPRINTF (stderr, "\n");
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1195,8 +1169,10 @@ yydestruct (yymsg, yytype, yyvaluep)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Prevent warnings from -Wmissing-prototypes. */
|
||||
|
||||
#ifdef YYPARSE_PARAM
|
||||
#if defined __STDC__ || defined __cplusplus
|
||||
int yyparse (void *YYPARSE_PARAM);
|
||||
@ -1212,10 +1188,11 @@ int yyparse ();
|
||||
#endif /* ! YYPARSE_PARAM */
|
||||
|
||||
|
||||
/* The lookahead symbol. */
|
||||
|
||||
/* The look-ahead symbol. */
|
||||
int yychar;
|
||||
|
||||
/* The semantic value of the lookahead symbol. */
|
||||
/* The semantic value of the look-ahead symbol. */
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* Number of syntax errors so far. */
|
||||
@ -1223,9 +1200,9 @@ int yynerrs;
|
||||
|
||||
|
||||
|
||||
/*-------------------------.
|
||||
| yyparse or yypush_parse. |
|
||||
`-------------------------*/
|
||||
/*----------.
|
||||
| yyparse. |
|
||||
`----------*/
|
||||
|
||||
#ifdef YYPARSE_PARAM
|
||||
#if (defined __STDC__ || defined __C99__FUNC__ \
|
||||
@ -1249,39 +1226,14 @@ yyparse ()
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
|
||||
|
||||
int yystate;
|
||||
/* Number of tokens to shift before error messages enabled. */
|
||||
int yyerrstatus;
|
||||
|
||||
/* The stacks and their tools:
|
||||
`yyss': related to states.
|
||||
`yyvs': related to semantic values.
|
||||
|
||||
Refer to the stacks thru separate pointers, to allow yyoverflow
|
||||
to reallocate them elsewhere. */
|
||||
|
||||
/* The state stack. */
|
||||
yytype_int16 yyssa[YYINITDEPTH];
|
||||
yytype_int16 *yyss;
|
||||
yytype_int16 *yyssp;
|
||||
|
||||
/* The semantic value stack. */
|
||||
YYSTYPE yyvsa[YYINITDEPTH];
|
||||
YYSTYPE *yyvs;
|
||||
YYSTYPE *yyvsp;
|
||||
|
||||
YYSIZE_T yystacksize;
|
||||
|
||||
|
||||
int yystate;
|
||||
int yyn;
|
||||
int yyresult;
|
||||
/* Lookahead token as an internal (translated) token number. */
|
||||
int yytoken;
|
||||
/* The variables used to return semantic value and location from the
|
||||
action routines. */
|
||||
YYSTYPE yyval;
|
||||
|
||||
/* Number of tokens to shift before error messages enabled. */
|
||||
int yyerrstatus;
|
||||
/* Look-ahead token as an internal (translated) token number. */
|
||||
int yytoken = 0;
|
||||
#if YYERROR_VERBOSE
|
||||
/* Buffer for error messages, and its allocated size. */
|
||||
char yymsgbuf[128];
|
||||
@ -1289,28 +1241,51 @@ yyparse ()
|
||||
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
|
||||
#endif
|
||||
|
||||
/* Three stacks and their tools:
|
||||
`yyss': related to states,
|
||||
`yyvs': related to semantic values,
|
||||
`yyls': related to locations.
|
||||
|
||||
Refer to the stacks thru separate pointers, to allow yyoverflow
|
||||
to reallocate them elsewhere. */
|
||||
|
||||
/* The state stack. */
|
||||
yytype_int16 yyssa[YYINITDEPTH];
|
||||
yytype_int16 *yyss = yyssa;
|
||||
yytype_int16 *yyssp;
|
||||
|
||||
/* The semantic value stack. */
|
||||
YYSTYPE yyvsa[YYINITDEPTH];
|
||||
YYSTYPE *yyvs = yyvsa;
|
||||
YYSTYPE *yyvsp;
|
||||
|
||||
|
||||
|
||||
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
|
||||
|
||||
YYSIZE_T yystacksize = YYINITDEPTH;
|
||||
|
||||
/* The variables used to return semantic value and location from the
|
||||
action routines. */
|
||||
YYSTYPE yyval;
|
||||
|
||||
|
||||
/* The number of symbols on the RHS of the reduced rule.
|
||||
Keep to zero when no symbol should be popped. */
|
||||
int yylen = 0;
|
||||
|
||||
yytoken = 0;
|
||||
yyss = yyssa;
|
||||
yyvs = yyvsa;
|
||||
yystacksize = YYINITDEPTH;
|
||||
|
||||
YYDPRINTF ((stderr, "Starting parse\n"));
|
||||
|
||||
yystate = 0;
|
||||
yyerrstatus = 0;
|
||||
yynerrs = 0;
|
||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||
|
||||
/* Initialize stack pointers.
|
||||
Waste one element of value and location stack
|
||||
so that they stay on the same level as the state stack.
|
||||
The wasted elements are never initialized. */
|
||||
|
||||
yyssp = yyss;
|
||||
yyvsp = yyvs;
|
||||
|
||||
@ -1340,6 +1315,7 @@ yyparse ()
|
||||
YYSTYPE *yyvs1 = yyvs;
|
||||
yytype_int16 *yyss1 = yyss;
|
||||
|
||||
|
||||
/* Each stack pointer address is followed by the size of the
|
||||
data in use in that stack, in bytes. This used to be a
|
||||
conditional around just the two extra args, but that might
|
||||
@ -1347,6 +1323,7 @@ yyparse ()
|
||||
yyoverflow (YY_("memory exhausted"),
|
||||
&yyss1, yysize * sizeof (*yyssp),
|
||||
&yyvs1, yysize * sizeof (*yyvsp),
|
||||
|
||||
&yystacksize);
|
||||
|
||||
yyss = yyss1;
|
||||
@ -1369,8 +1346,9 @@ yyparse ()
|
||||
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
||||
if (! yyptr)
|
||||
goto yyexhaustedlab;
|
||||
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
||||
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
|
||||
YYSTACK_RELOCATE (yyss);
|
||||
YYSTACK_RELOCATE (yyvs);
|
||||
|
||||
# undef YYSTACK_RELOCATE
|
||||
if (yyss1 != yyssa)
|
||||
YYSTACK_FREE (yyss1);
|
||||
@ -1381,6 +1359,7 @@ yyparse ()
|
||||
yyssp = yyss + yysize - 1;
|
||||
yyvsp = yyvs + yysize - 1;
|
||||
|
||||
|
||||
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
||||
(unsigned long int) yystacksize));
|
||||
|
||||
@ -1390,9 +1369,6 @@ yyparse ()
|
||||
|
||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||
|
||||
if (yystate == YYFINAL)
|
||||
YYACCEPT;
|
||||
|
||||
goto yybackup;
|
||||
|
||||
/*-----------.
|
||||
@ -1401,16 +1377,16 @@ yyparse ()
|
||||
yybackup:
|
||||
|
||||
/* Do appropriate processing given the current state. Read a
|
||||
lookahead token if we need one and don't already have one. */
|
||||
look-ahead token if we need one and don't already have one. */
|
||||
|
||||
/* First try to decide what to do without reference to lookahead token. */
|
||||
/* First try to decide what to do without reference to look-ahead token. */
|
||||
yyn = yypact[yystate];
|
||||
if (yyn == YYPACT_NINF)
|
||||
goto yydefault;
|
||||
|
||||
/* Not known => get a lookahead token if don't already have one. */
|
||||
/* Not known => get a look-ahead token if don't already have one. */
|
||||
|
||||
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
|
||||
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
|
||||
if (yychar == YYEMPTY)
|
||||
{
|
||||
YYDPRINTF ((stderr, "Reading a token: "));
|
||||
@ -1442,16 +1418,20 @@ yybackup:
|
||||
goto yyreduce;
|
||||
}
|
||||
|
||||
if (yyn == YYFINAL)
|
||||
YYACCEPT;
|
||||
|
||||
/* Count tokens shifted since error; after three, turn off error
|
||||
status. */
|
||||
if (yyerrstatus)
|
||||
yyerrstatus--;
|
||||
|
||||
/* Shift the lookahead token. */
|
||||
/* Shift the look-ahead token. */
|
||||
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
||||
|
||||
/* Discard the shifted token. */
|
||||
yychar = YYEMPTY;
|
||||
/* Discard the shifted token unless it is eof. */
|
||||
if (yychar != YYEOF)
|
||||
yychar = YYEMPTY;
|
||||
|
||||
yystate = yyn;
|
||||
*++yyvsp = yylval;
|
||||
@ -1491,8 +1471,6 @@ yyreduce:
|
||||
switch (yyn)
|
||||
{
|
||||
case 2:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 133 "parser.y"
|
||||
{
|
||||
_finalUnit = ut_get_dimensionless_unit_one(_unitSystem);
|
||||
@ -1501,8 +1479,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 137 "parser.y"
|
||||
{
|
||||
_finalUnit = (yyvsp[(1) - (1)].unit);
|
||||
@ -1511,8 +1487,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 141 "parser.y"
|
||||
{
|
||||
ut_set_status(UT_SYNTAX);
|
||||
@ -1521,8 +1495,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 147 "parser.y"
|
||||
{
|
||||
(yyval.unit) = (yyvsp[(1) - (1)].unit);
|
||||
@ -1530,8 +1502,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 6:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 150 "parser.y"
|
||||
{
|
||||
(yyval.unit) = ut_offset((yyvsp[(1) - (3)].unit), (yyvsp[(3) - (3)].rval));
|
||||
@ -1544,8 +1514,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 7:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 158 "parser.y"
|
||||
{
|
||||
(yyval.unit) = ut_offset((yyvsp[(1) - (3)].unit), (yyvsp[(3) - (3)].ival));
|
||||
@ -1558,8 +1526,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 8:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 166 "parser.y"
|
||||
{
|
||||
(yyval.unit) = ut_offset_by_time((yyvsp[(1) - (3)].unit), (yyvsp[(3) - (3)].rval));
|
||||
@ -1572,8 +1538,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 9:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 176 "parser.y"
|
||||
{
|
||||
(yyval.unit) = (yyvsp[(1) - (1)].unit);
|
||||
@ -1581,8 +1545,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 10:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 179 "parser.y"
|
||||
{
|
||||
(yyval.unit) = ut_multiply((yyvsp[(1) - (2)].unit), (yyvsp[(2) - (2)].unit));
|
||||
@ -1596,8 +1558,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 11:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 188 "parser.y"
|
||||
{
|
||||
(yyval.unit) = ut_multiply((yyvsp[(1) - (3)].unit), (yyvsp[(3) - (3)].unit));
|
||||
@ -1611,8 +1571,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 12:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 197 "parser.y"
|
||||
{
|
||||
(yyval.unit) = ut_divide((yyvsp[(1) - (3)].unit), (yyvsp[(3) - (3)].unit));
|
||||
@ -1626,8 +1584,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 13:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 208 "parser.y"
|
||||
{
|
||||
(yyval.unit) = (yyvsp[(1) - (1)].unit);
|
||||
@ -1635,8 +1591,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 14:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 211 "parser.y"
|
||||
{
|
||||
(yyval.unit) = ut_raise((yyvsp[(1) - (2)].unit), (yyvsp[(2) - (2)].ival));
|
||||
@ -1649,8 +1603,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 15:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 219 "parser.y"
|
||||
{
|
||||
(yyval.unit) = ut_raise((yyvsp[(1) - (2)].unit), (yyvsp[(2) - (2)].ival));
|
||||
@ -1663,8 +1615,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 16:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 229 "parser.y"
|
||||
{
|
||||
double prefix = 1;
|
||||
@ -1717,8 +1667,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 17:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 277 "parser.y"
|
||||
{
|
||||
(yyval.unit) = (yyvsp[(2) - (3)].unit);
|
||||
@ -1726,8 +1674,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 18:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 280 "parser.y"
|
||||
{
|
||||
(yyval.unit) = ut_log((yyvsp[(1) - (3)].rval), (yyvsp[(2) - (3)].unit));
|
||||
@ -1740,8 +1686,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 19:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 288 "parser.y"
|
||||
{
|
||||
(yyval.unit) = ut_scale((yyvsp[(1) - (1)].rval),
|
||||
@ -1750,8 +1694,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 20:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 294 "parser.y"
|
||||
{
|
||||
(yyval.rval) = (yyvsp[(1) - (1)].ival);
|
||||
@ -1759,8 +1701,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 21:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 297 "parser.y"
|
||||
{
|
||||
(yyval.rval) = (yyvsp[(1) - (1)].rval);
|
||||
@ -1768,8 +1708,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 22:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 302 "parser.y"
|
||||
{
|
||||
(yyval.rval) = (yyvsp[(1) - (1)].rval);
|
||||
@ -1777,8 +1715,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 23:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 305 "parser.y"
|
||||
{
|
||||
(yyval.rval) = (yyvsp[(1) - (2)].rval) + (yyvsp[(2) - (2)].rval);
|
||||
@ -1786,8 +1722,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 24:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 308 "parser.y"
|
||||
{
|
||||
(yyval.rval) = (yyvsp[(1) - (3)].rval) + ((yyvsp[(2) - (3)].rval) - (yyvsp[(3) - (3)].rval));
|
||||
@ -1795,8 +1729,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 25:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 311 "parser.y"
|
||||
{
|
||||
int mag = (yyvsp[(3) - (3)].ival) >= 0 ? (yyvsp[(3) - (3)].ival) : -(yyvsp[(3) - (3)].ival);
|
||||
@ -1814,8 +1746,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 26:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 324 "parser.y"
|
||||
{
|
||||
int error = 0;
|
||||
@ -1839,8 +1769,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 27:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 343 "parser.y"
|
||||
{
|
||||
(yyval.rval) = (yyvsp[(1) - (1)].rval);
|
||||
@ -1848,8 +1776,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 28:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 346 "parser.y"
|
||||
{
|
||||
(yyval.rval) = (yyvsp[(1) - (2)].rval) - (yyvsp[(2) - (2)].rval);
|
||||
@ -1857,8 +1783,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 29:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 349 "parser.y"
|
||||
{
|
||||
int mag = (yyvsp[(2) - (2)].ival) >= 0 ? (yyvsp[(2) - (2)].ival) : -(yyvsp[(2) - (2)].ival);
|
||||
@ -1876,8 +1800,6 @@ yyreduce:
|
||||
break;
|
||||
|
||||
case 30:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 362 "parser.y"
|
||||
{
|
||||
int error = 0;
|
||||
@ -1901,9 +1823,8 @@ yyreduce:
|
||||
break;
|
||||
|
||||
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 1907 "parser.c"
|
||||
/* Line 1267 of yacc.c. */
|
||||
#line 1828 "parser.c"
|
||||
default: break;
|
||||
}
|
||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
||||
@ -1914,6 +1835,7 @@ yyreduce:
|
||||
|
||||
*++yyvsp = yyval;
|
||||
|
||||
|
||||
/* Now `shift' the result of the reduction. Determine what state
|
||||
that goes to, based on the state we popped back to and the rule
|
||||
number reduced by. */
|
||||
@ -1978,7 +1900,7 @@ yyerrlab:
|
||||
|
||||
if (yyerrstatus == 3)
|
||||
{
|
||||
/* If just tried and failed to reuse lookahead token after an
|
||||
/* If just tried and failed to reuse look-ahead token after an
|
||||
error, discard it. */
|
||||
|
||||
if (yychar <= YYEOF)
|
||||
@ -1995,7 +1917,7 @@ yyerrlab:
|
||||
}
|
||||
}
|
||||
|
||||
/* Else will try to reuse lookahead token after shifting the error
|
||||
/* Else will try to reuse look-ahead token after shifting the error
|
||||
token. */
|
||||
goto yyerrlab1;
|
||||
|
||||
@ -2052,6 +1974,9 @@ yyerrlab1:
|
||||
YY_STACK_PRINT (yyss, yyssp);
|
||||
}
|
||||
|
||||
if (yyn == YYFINAL)
|
||||
YYACCEPT;
|
||||
|
||||
*++yyvsp = yylval;
|
||||
|
||||
|
||||
@ -2076,7 +2001,7 @@ yyabortlab:
|
||||
yyresult = 1;
|
||||
goto yyreturn;
|
||||
|
||||
#if !defined(yyoverflow) || YYERROR_VERBOSE
|
||||
#ifndef yyoverflow
|
||||
/*-------------------------------------------------.
|
||||
| yyexhaustedlab -- memory exhaustion comes here. |
|
||||
`-------------------------------------------------*/
|
||||
@ -2087,7 +2012,7 @@ yyexhaustedlab:
|
||||
#endif
|
||||
|
||||
yyreturn:
|
||||
if (yychar != YYEMPTY)
|
||||
if (yychar != YYEOF && yychar != YYEMPTY)
|
||||
yydestruct ("Cleanup: discarding lookahead",
|
||||
yytoken, &yylval);
|
||||
/* Do not reclaim the symbols of the rule which action triggered
|
||||
@ -2113,8 +2038,6 @@ yyreturn:
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Line 1684 of yacc.c */
|
||||
#line 383 "parser.y"
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user