mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
This commit is contained in:
parent
22c4b21d32
commit
e66b07f9a5
@ -38,7 +38,7 @@ DOBUILD () {
|
||||
rm -rf $BDIR
|
||||
mkdir -p $BDIR
|
||||
cd $BDIR
|
||||
CMAKE_PREFIX_PATH=$RESOURCE_DIR cmake $CURDIR -G"$CMAKEGEN" -DCPACK_PACKAGE_FILE_NAME=NetCDF-$NAME -DENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=$SHARED -DENABLE_DAP=$DAP -DENABLE_NETCDF_4=$NC4
|
||||
CMAKE_PREFIX_PATH=$RESOURCE_DIR cmake $CURDIR -G"$CMAKEGEN" -DCPACK_PACKAGE_FILE_NAME=NetCDF-$NAME -DENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=$SHARED -DENABLE_DAP=$DAP -DENABLE_NETCDF_4=$NC4 $POSTFLAGS
|
||||
CHECKERR
|
||||
|
||||
cmake --build .
|
||||
@ -71,11 +71,12 @@ case $unamestr in
|
||||
Darwin) echo "Configuring Darwin"
|
||||
CMAKEGEN32="Unix Makefiles"
|
||||
CMAKEGEN64="Unix Makefiles"
|
||||
POSTFLAGS=-D'CMAKE_OSX_ARCHITECTURES=i386;x86_64'
|
||||
|
||||
;;
|
||||
MINGW32_NT-6.1) echo "Configuring MSYS/MinGW"
|
||||
CMAKEGEN32="Visual Studio 10"
|
||||
CMAKEGEN64="Visual Studio 10 Win64"
|
||||
POSTFLAGS="-DUSE_SZIP=ON"
|
||||
;;
|
||||
*) echo "Unknown platform: $unamestr"
|
||||
exit 1
|
||||
|
@ -10,7 +10,14 @@
|
||||
#define open _open
|
||||
#define close _close
|
||||
#define read _read
|
||||
#define lseek _lseek
|
||||
#ifdef _WIN64
|
||||
#define lseek _lseeki64
|
||||
#else
|
||||
#define lseek _lseek
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define strdup _strdup
|
||||
#define fdopen _fdopen
|
||||
#define write _write
|
||||
|
@ -391,7 +391,6 @@ by the desired type. */
|
||||
*/
|
||||
|
||||
/* Declaration modifiers for DLL support (MSC et al) */
|
||||
|
||||
#if defined(DLL_NETCDF) /* define when library is a DLL */
|
||||
# if defined(DLL_EXPORT) /* define when building the library */
|
||||
# define MSC_EXTRA __declspec(dllexport)
|
||||
@ -399,14 +398,20 @@ by the desired type. */
|
||||
# define MSC_EXTRA __declspec(dllimport)
|
||||
# endif
|
||||
#include <io.h>
|
||||
/*#define lseek _lseeki64
|
||||
#define off_t __int64*/
|
||||
#else
|
||||
#define MSC_EXTRA
|
||||
#endif /* defined(DLL_NETCDF) */
|
||||
|
||||
# define EXTERNL MSC_EXTRA extern
|
||||
|
||||
/* Define for 64 bit windows. */
|
||||
#if defined (_WIN64)
|
||||
#define off_t __int64
|
||||
#define size_t __int64
|
||||
//#define lseek _lseeki64
|
||||
#define _OFF_T_DEFINED
|
||||
#endif
|
||||
|
||||
#if defined(DLL_NETCDF) /* define when library is a DLL */
|
||||
EXTERNL int ncerr;
|
||||
EXTERNL int ncopts;
|
||||
|
@ -12,7 +12,7 @@ See \ref copyright file for copying and redistribution conditions.
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "netcdf.h"
|
||||
|
||||
#include "math.h"
|
||||
/* The subroutines in error.c emit no messages unless NC_VERBOSE bit
|
||||
* is on. They call exit() when NC_FATAL bit is on. */
|
||||
int ncopts = (NC_FATAL | NC_VERBOSE) ;
|
||||
@ -43,7 +43,7 @@ int ncerr = NC_NOERR ;
|
||||
|
||||
# include "onstack.h"
|
||||
|
||||
static size_t
|
||||
static int
|
||||
nvdims(int ncid, int varid)
|
||||
{
|
||||
int ndims=-1, status;
|
||||
@ -56,16 +56,27 @@ nvdims(int ncid, int varid)
|
||||
return ndims;
|
||||
}
|
||||
|
||||
#define NDIMS_DECL const size_t ndims = nvdims(ncid, varid);
|
||||
static void* nvmalloc(int ct, int size) {
|
||||
int mct = ct;
|
||||
if(ct < 0) mct = 1;
|
||||
|
||||
return malloc(mct * size);
|
||||
|
||||
}
|
||||
|
||||
#define NDIMS_DECL const int ndims = nvdims(ncid, varid);
|
||||
|
||||
|
||||
# define A_DECL(name, type, ndims, rhs) \
|
||||
ALLOC_ONSTACK(name, type, ndims)
|
||||
type *const name = (type *) nvmalloc(ndims,sizeof(type))
|
||||
//ALLOC_ONSTACK(name, type, ndims)
|
||||
|
||||
# define A_FREE(name) \
|
||||
FREE_ONSTACK(name)
|
||||
|
||||
# define A_INIT(lhs, type, ndims, rhs) \
|
||||
{ \
|
||||
if(ndims >= 0) { \
|
||||
const long *lp = rhs; \
|
||||
type *tp = lhs; \
|
||||
type *const end = lhs + ndims; \
|
||||
@ -73,7 +84,10 @@ nvdims(int ncid, int varid)
|
||||
{ \
|
||||
*tp++ = (type) *lp++; \
|
||||
} \
|
||||
}
|
||||
} \
|
||||
} \
|
||||
\
|
||||
if (ndims < 0) {nc_advise("nvdims",NC_EMAXDIMS,"ndims %d",ndims); return -1;}
|
||||
|
||||
|
||||
#endif
|
||||
@ -664,8 +678,23 @@ ncvarput1(
|
||||
)
|
||||
{
|
||||
NDIMS_DECL
|
||||
A_DECL(coordp, size_t, ndims, index);
|
||||
A_INIT(coordp, size_t, ndims, index);
|
||||
A_DECL(coordp, size_t, (size_t)ndims, index);
|
||||
A_INIT(coordp, size_t, (size_t)ndims, index);
|
||||
|
||||
//const int ndims = nvdims(ncid,varid); //NDIMS_DECL
|
||||
//int ndims2 = min(1,ndims);
|
||||
//size_t *const coordp = (size_t*)malloc((ndims2)*sizeof(size_t)) ;
|
||||
|
||||
//const long *lp = index;
|
||||
//size_t *tp = coordp;
|
||||
//size_t *const end = coordp + ndims;
|
||||
//while(tp < end)
|
||||
//{
|
||||
// *tp++ = (size_t) *lp++;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
{
|
||||
const int status = nc_put_var1(ncid, varid, coordp, value);
|
||||
A_FREE(coordp);
|
||||
@ -773,7 +802,9 @@ ncvarputs(
|
||||
return ncvarput(ncid, varid, start, count, value);
|
||||
/* else */
|
||||
{
|
||||
NDIMS_DECL
|
||||
|
||||
NDIMS_DECL
|
||||
|
||||
A_DECL(stp, size_t, ndims, start);
|
||||
A_DECL(cntp, size_t, ndims, count);
|
||||
A_DECL(strdp, ptrdiff_t, ndims, stride);
|
||||
|
@ -9,8 +9,6 @@
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
#include <io.h>
|
||||
#define fstat64 fstat
|
||||
#define lseek64 lseek
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
|
Loading…
Reference in New Issue
Block a user