mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
merge recent trunk changes
This commit is contained in:
commit
bd267e503b
@ -179,11 +179,7 @@ check_err(int stat)
|
||||
{
|
||||
if(stat == NC_NOERR) return;
|
||||
fprintf(stderr,"error status returned: (%d) %s\n",stat,
|
||||
#ifdef USE_NETCDF4
|
||||
nc3_strerror(stat)
|
||||
#else
|
||||
nc_strerror(stat)
|
||||
#endif
|
||||
);
|
||||
fail();
|
||||
}
|
||||
|
@ -19,12 +19,3 @@ NC_initialize(void)
|
||||
NCD3_initialize();
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
#ifdef USE_NETCDF4
|
||||
extern const char* nc3_strerror(int);
|
||||
const char*
|
||||
nc_strerror(int err)
|
||||
{
|
||||
return nc3_strerror(err);
|
||||
}
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@ netcdf.3: $(top_srcdir)/man4/netcdf.m4
|
||||
m4 $(M4FLAGS) $(ARGS_MANPAGE) $? >$@ || rm $@
|
||||
|
||||
# These files are part of the netCDF-3 library.
|
||||
libnetcdf3_la_SOURCES = nc.h error3.c libvers.c string.c v1hpg.c fbits.h ncio.h \
|
||||
libnetcdf3_la_SOURCES = nc.h string.c v1hpg.c fbits.h ncio.h \
|
||||
onstack.h rnd.h utf8proc.c utf8proc.h utf8proc_data.h nclistmgr.c \
|
||||
putget.m4 attr.m4 nc3dispatch.c nc3dispatch.h nc.c var.c dim.c ncx.m4 \
|
||||
ncx.h lookup3.c pstdint.h
|
||||
|
200
libsrc/error3.c
200
libsrc/error3.c
@ -1,200 +0,0 @@
|
||||
/*
|
||||
* Copyright 1993, University Corporation for Atmospheric Research
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
*/
|
||||
/* $Id: error.c,v 1.14 90/02/23 16:08:55 davis Exp */
|
||||
|
||||
/*LINTLIBRARY*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "netcdf.h"
|
||||
|
||||
#ifdef HAVE_STRERROR
|
||||
#include <string.h> /* contains prototype for ansi libc function strerror() */
|
||||
#else
|
||||
#if defined DLL_NETCDF || defined _WIN32_WCE /* define when library is a DLL */
|
||||
/* provide a strerror function for older windows systems */
|
||||
|
||||
char w32_tmp[NC_MAX_NAME];
|
||||
static char *
|
||||
strerror(int errnum)
|
||||
{
|
||||
sprintf(w32_tmp, "Windows: %d", errnum);
|
||||
return w32_tmp;
|
||||
}
|
||||
#else
|
||||
/* provide a strerror function for older unix systems */
|
||||
static char *
|
||||
strerror(int errnum)
|
||||
{
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
|
||||
if(errnum < 0 || errnum >= sys_nerr) return NULL;
|
||||
/* else */
|
||||
return (char *)(sys_errlist[errnum]);
|
||||
}
|
||||
#endif
|
||||
#endif /* NO_STRERROR */
|
||||
|
||||
|
||||
#ifdef vms
|
||||
/* UNTESTED */
|
||||
/*
|
||||
* On the vms system, when a system error occurs which is not
|
||||
* mapped into the unix styled errno values, errno is set EVMSERR
|
||||
* and a VMS error code is set in vaxc$errno.
|
||||
* This routine prints the systems message associated with status return
|
||||
* from a system services call.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <descrip.h>
|
||||
#include <ssdef.h>
|
||||
|
||||
static const char *
|
||||
vms_strerror( int status )
|
||||
{
|
||||
short msglen;
|
||||
static char msgbuf[256];
|
||||
$DESCRIPTOR(message, msgbuf);
|
||||
register ret;
|
||||
|
||||
msgbuf[0] = 0;
|
||||
ret = SYS$GETMSG(status, &msglen, &message, 15, 0);
|
||||
|
||||
if(ret != SS$_BUFFEROVF && ret != SS$_NORMAL) {
|
||||
(void) strcpy(msgbuf, "EVMSERR");
|
||||
}
|
||||
return(msgbuf);
|
||||
}
|
||||
#endif /* vms */
|
||||
|
||||
|
||||
static char unknown[] = "Unknown Error";
|
||||
|
||||
#ifdef USE_NETCDF4
|
||||
const char *
|
||||
nc3_strerror(int err)
|
||||
#else
|
||||
const char *
|
||||
nc_strerror(int err)
|
||||
#endif
|
||||
{
|
||||
|
||||
#ifdef vms
|
||||
if(err == EVMSERR)
|
||||
{
|
||||
return vms_strerror(err);
|
||||
}
|
||||
/* else */
|
||||
#endif /* vms */
|
||||
|
||||
if(NC_ISSYSERR(err))
|
||||
{
|
||||
const char *cp = (const char *) strerror(err);
|
||||
if(cp == NULL)
|
||||
return unknown;
|
||||
/* else */
|
||||
return cp;
|
||||
}
|
||||
/* else */
|
||||
|
||||
switch (err) {
|
||||
case NC_NOERR:
|
||||
return "No error";
|
||||
case NC_EBADID:
|
||||
return "NetCDF: Not a valid ID";
|
||||
case NC_ENFILE:
|
||||
return "NetCDF: Too many files open";
|
||||
case NC_EEXIST:
|
||||
return "NetCDF: File exists && NC_NOCLOBBER";
|
||||
case NC_EINVAL:
|
||||
return "NetCDF: Invalid argument";
|
||||
case NC_EPERM:
|
||||
return "NetCDF: Write to read only";
|
||||
case NC_ENOTINDEFINE:
|
||||
return "NetCDF: Operation not allowed in data mode";
|
||||
case NC_EINDEFINE:
|
||||
return "NetCDF: Operation not allowed in define mode";
|
||||
case NC_EINVALCOORDS:
|
||||
return "NetCDF: Index exceeds dimension bound";
|
||||
case NC_EMAXDIMS:
|
||||
return "NetCDF: NC_MAX_DIMS exceeded";
|
||||
case NC_ENAMEINUSE:
|
||||
return "NetCDF: String match to name in use";
|
||||
case NC_ENOTATT:
|
||||
return "NetCDF: Attribute not found";
|
||||
case NC_EMAXATTS:
|
||||
return "NetCDF: NC_MAX_ATTRS exceeded";
|
||||
case NC_EBADTYPE:
|
||||
return "NetCDF: Not a valid data type or _FillValue type mismatch";
|
||||
case NC_EBADDIM:
|
||||
return "NetCDF: Invalid dimension ID or name";
|
||||
case NC_EUNLIMPOS:
|
||||
return "NetCDF: NC_UNLIMITED in the wrong index";
|
||||
case NC_EMAXVARS:
|
||||
return "NetCDF: NC_MAX_VARS exceeded";
|
||||
case NC_ENOTVAR:
|
||||
return "NetCDF: Variable not found";
|
||||
case NC_EGLOBAL:
|
||||
return "NetCDF: Action prohibited on NC_GLOBAL varid";
|
||||
case NC_ENOTNC:
|
||||
return "NetCDF: Unknown file format";
|
||||
case NC_ESTS:
|
||||
return "NetCDF: In Fortran, string too short";
|
||||
case NC_EMAXNAME:
|
||||
return "NetCDF: NC_MAX_NAME exceeded";
|
||||
case NC_EUNLIMIT:
|
||||
return "NetCDF: NC_UNLIMITED size already in use";
|
||||
case NC_ENORECVARS:
|
||||
return "NetCDF: nc_rec op when there are no record vars";
|
||||
case NC_ECHAR:
|
||||
return "NetCDF: Attempt to convert between text & numbers";
|
||||
case NC_EEDGE:
|
||||
return "NetCDF: Start+count exceeds dimension bound";
|
||||
case NC_ESTRIDE:
|
||||
return "NetCDF: Illegal stride";
|
||||
case NC_EBADNAME:
|
||||
return "NetCDF: Name contains illegal characters";
|
||||
case NC_ERANGE:
|
||||
return "NetCDF: Numeric conversion not representable";
|
||||
case NC_ENOMEM:
|
||||
return "NetCDF: Memory allocation (malloc) failure";
|
||||
case NC_EVARSIZE:
|
||||
return "NetCDF: One or more variable sizes violate format constraints";
|
||||
case NC_EDIMSIZE:
|
||||
return "NetCDF: Invalid dimension size";
|
||||
case NC_ETRUNC:
|
||||
return "NetCDF: File likely truncated or possibly corrupted";
|
||||
case NC_EAXISTYPE:
|
||||
return "NetCDF: Illegal axis type";
|
||||
case NC_EDAP:
|
||||
return "NetCDF: DAP failure";
|
||||
case NC_ECURL:
|
||||
return "NetCDF: libcurl failure";
|
||||
case NC_EIO:
|
||||
return "NetCDF: I/O failure";
|
||||
case NC_ENODATA:
|
||||
return "NetCDF: Variable has no data in DAP request";
|
||||
case NC_EDAPSVC:
|
||||
return "NetCDF: DAP server error";
|
||||
case NC_EDAS:
|
||||
return "NetCDF: Malformed or inaccessible DAP DAS";
|
||||
case NC_EDDS:
|
||||
return "NetCDF: Malformed or inaccessible DAP DDS";
|
||||
case NC_EDATADDS:
|
||||
return "NetCDF: Malformed or inaccessible DAP DATADDS";
|
||||
case NC_EDAPURL:
|
||||
return "NetCDF: Malformed DAP URL";
|
||||
case NC_EDAPCONSTRAINT:
|
||||
return "NetCDF: Malformed DAP Constraint";
|
||||
default: break;
|
||||
}
|
||||
/* default */
|
||||
return unknown;
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 1996, University Corporation for Atmospheric Research
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
*/
|
||||
/* $Id: libvers.c,v 2.17 2010/05/26 21:43:33 dmh Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/*
|
||||
* A version string. This whole function is not needed in netCDF-4,
|
||||
* which has it's own version of this function.
|
||||
*/
|
||||
#ifndef USE_NETCDF4
|
||||
#define SKIP_LEADING_GARBAGE 33 /* # of chars prior to the actual version */
|
||||
#define XSTRING(x) #x
|
||||
#define STRING(x) XSTRING(x)
|
||||
static const char nc_libvers[] =
|
||||
"\044Id: \100(#) netcdf library version " VERSION " of "__DATE__" "__TIME__" $";
|
||||
|
||||
const char *
|
||||
nc_inq_libvers(void)
|
||||
{
|
||||
return &nc_libvers[SKIP_LEADING_GARBAGE];
|
||||
}
|
||||
|
||||
#else
|
||||
typedef int ignore; /* define at least one symbol */
|
||||
#endif /* USE_NETCDF4*/
|
@ -68,10 +68,6 @@ union getret
|
||||
};
|
||||
|
||||
|
||||
#ifdef USE_NETCDF4
|
||||
const char *nc3_strerror(int ncerr);
|
||||
#endif
|
||||
|
||||
static void
|
||||
chkgot(nc_type type, union getret got, double check)
|
||||
{
|
||||
@ -466,14 +462,9 @@ 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,
|
||||
(void) printf("Could not open %s: %s\n", fname,
|
||||
nc_strerror(ret));
|
||||
#endif
|
||||
exit(1);
|
||||
exit(1);
|
||||
}
|
||||
(void) printf("reopen id = %d for filename %s\n",
|
||||
id, fname);
|
||||
|
@ -1231,6 +1231,8 @@ walkchararray(Symbol* vsym, Datalist* fillsrc)
|
||||
the string and then pad to the dim product
|
||||
*/
|
||||
size_t slabsize = arraylength(dimset);
|
||||
/* If rank is 1, then dont' pad the string */
|
||||
if(rank == 1) lastdimsize = 1;
|
||||
if(!buildcanonicalcharlist(vsym->data,lastdimsize,fillchar,&newcon))
|
||||
return;
|
||||
/* pad to slabsize */
|
||||
|
Loading…
Reference in New Issue
Block a user