Commit 692956f9 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

change to EXSE library version 1.4.0

parent e8ee384e
...@@ -233,6 +233,7 @@ src/docu -text ...@@ -233,6 +233,7 @@ src/docu -text
src/dtypes.h -text src/dtypes.h -text
src/error.c -text src/error.c -text
src/error.h -text src/error.h -text
src/exse.h -text
src/extra.h -text src/extra.h -text
src/extralib.c -text src/extralib.c -text
src/file.c -text src/file.c -text
......
2015-10-28 Uwe Schulzweida 2015-10-28 Uwe Schulzweida
* Version 1.7.0 released * Version 1.7.0 released
* using EXSE library version 1.4.0
2015-09-15 Uwe Schulzweida 2015-09-15 Uwe Schulzweida
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION], m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
[m4_warning([this file was generated for autoconf 2.69. [m4_warning([this file was generated for autoconf 2.68.
You have another version of autoconf. It may work, but is not guaranteed to. You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely. If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])]) To do so, use the procedure documented by the package, typically 'autoreconf'.])])
......
This diff is collapsed.
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
AC_INIT([cdi], [1.7.0rc5], [http://mpimet.mpg.de/cdi]) AC_INIT([cdi], [1.7.0rc5], [http://mpimet.mpg.de/cdi])
AC_DEFINE_UNQUOTED(CDI, ["$PACKAGE_VERSION"], [CDI version])
echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}" echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"
CONFIG_ABORT=yes CONFIG_ABORT=yes
......
...@@ -41,6 +41,7 @@ libcdi_la_SOURCES = \ ...@@ -41,6 +41,7 @@ libcdi_la_SOURCES = \
dtypes.h \ dtypes.h \
error.c \ error.c \
error.h \ error.h \
exse.h \
extra.h \ extra.h \
extralib.c \ extralib.c \
file.c \ file.c \
......
...@@ -167,12 +167,12 @@ am__libcdi_la_SOURCES_DIST = basetime.c basetime.h binary.c binary.h \ ...@@ -167,12 +167,12 @@ am__libcdi_la_SOURCES_DIST = basetime.c basetime.h binary.c binary.h \
calendar.c calendar.h cdf.c cdf.h cdf_int.c cdf_int.h cdi.h \ calendar.c calendar.h cdf.c cdf.h cdf_int.c cdf_int.h cdi.h \
cdi_error.c cdi_limits.h cdi_util.c cgribex.h cgribexlib.c \ cdi_error.c cdi_limits.h cdi_util.c cgribex.h cgribexlib.c \
datetime.h dmemory.c dmemory.h cksum.c cksum.h cdi_cksum.c \ datetime.h dmemory.c dmemory.h cksum.c cksum.h cdi_cksum.c \
cdi_cksum.h create_uuid.h dtypes.h error.c error.h extra.h \ cdi_cksum.h create_uuid.h dtypes.h error.c error.h exse.h \
extralib.c file.c file.h gaussgrid.c gaussgrid.h gribapi.c \ extra.h extralib.c file.c file.h gaussgrid.c gaussgrid.h \
gribapi.h gribapi_utilities.c gribapi_utilities.h grid.c \ gribapi.c gribapi.h gribapi_utilities.c gribapi_utilities.h \
grid.h ieg.h ieglib.c input_file.c input_file.h institution.c \ grid.c grid.h ieg.h ieglib.c input_file.c input_file.h \
institution.h model.c model.h namespace.c namespace.h \ institution.c institution.h model.c model.h namespace.c \
serialize.h serialize.c referenceCounting.c \ namespace.h serialize.h serialize.c referenceCounting.c \
referenceCounting.h resource_handle.c resource_handle.h \ referenceCounting.h resource_handle.c resource_handle.h \
service.h servicelib.c stream_cdf.c stream_cdf.h \ service.h servicelib.c stream_cdf.c stream_cdf.h \
stream_cgribex.c stream_cgribex.h stream_ext.c stream_ext.h \ stream_cgribex.c stream_cgribex.h stream_ext.c stream_ext.h \
...@@ -494,25 +494,25 @@ libcdi_la_SOURCES = basetime.c basetime.h binary.c binary.h calendar.c \ ...@@ -494,25 +494,25 @@ libcdi_la_SOURCES = basetime.c basetime.h binary.c binary.h calendar.c \
calendar.h cdf.c cdf.h cdf_int.c cdf_int.h cdi.h cdi_error.c \ calendar.h cdf.c cdf.h cdf_int.c cdf_int.h cdi.h cdi_error.c \
cdi_limits.h cdi_util.c cgribex.h cgribexlib.c datetime.h \ cdi_limits.h cdi_util.c cgribex.h cgribexlib.c datetime.h \
dmemory.c dmemory.h cksum.c cksum.h cdi_cksum.c cdi_cksum.h \ dmemory.c dmemory.h cksum.c cksum.h cdi_cksum.c cdi_cksum.h \
create_uuid.h dtypes.h error.c error.h extra.h extralib.c \ create_uuid.h dtypes.h error.c error.h exse.h extra.h \
file.c file.h gaussgrid.c gaussgrid.h gribapi.c gribapi.h \ extralib.c file.c file.h gaussgrid.c gaussgrid.h gribapi.c \
gribapi_utilities.c gribapi_utilities.h grid.c grid.h ieg.h \ gribapi.h gribapi_utilities.c gribapi_utilities.h grid.c \
ieglib.c input_file.c input_file.h institution.c institution.h \ grid.h ieg.h ieglib.c input_file.c input_file.h institution.c \
model.c model.h namespace.c namespace.h serialize.h \ institution.h model.c model.h namespace.c namespace.h \
serialize.c referenceCounting.c referenceCounting.h \ serialize.h serialize.c referenceCounting.c \
resource_handle.c resource_handle.h service.h servicelib.c \ referenceCounting.h resource_handle.c resource_handle.h \
stream_cdf.c stream_cdf.h stream_cgribex.c stream_cgribex.h \ service.h servicelib.c stream_cdf.c stream_cdf.h \
stream_ext.c stream_ext.h stream_grb.c stream_grb.h \ stream_cgribex.c stream_cgribex.h stream_ext.c stream_ext.h \
stream_gribapi.c stream_gribapi.h stream_history.c \ stream_grb.c stream_grb.h stream_gribapi.c stream_gribapi.h \
stream_ieg.c stream_ieg.h stream_fcommon.c stream_fcommon.h \ stream_history.c stream_ieg.c stream_ieg.h stream_fcommon.c \
cdi_int.c cdi_int.h stream_record.c stream_srv.c stream_srv.h \ stream_fcommon.h cdi_int.c cdi_int.h stream_record.c \
stream_var.c subtype.c subtype.h swap.h table.c table.h \ stream_srv.c stream_srv.h stream_var.c subtype.c subtype.h \
tablepar.h taxis.c taxis.h timebase.c timebase.h tsteps.c \ swap.h table.c table.h tablepar.h taxis.c taxis.h timebase.c \
util.c varscan.c varscan.h version.c vlist.c vlist.h \ timebase.h tsteps.c util.c varscan.c varscan.h version.c \
vlist_att.c vlist_att.h vlist_var.c vlist_var.h zaxis.c \ vlist.c vlist.h vlist_att.c vlist_att.h vlist_var.c \
zaxis.h stream.c swap.c iterator.c iterator.h \ vlist_var.h zaxis.c zaxis.h stream.c swap.c iterator.c \
iterator_fallback.c iterator_fallback.h iterator_grib.c \ iterator.h iterator_fallback.c iterator_fallback.h \
iterator_grib.h $(am__append_2) iterator_grib.c iterator_grib.h $(am__append_2)
# cfortran.h is an optional part of libcdi # cfortran.h is an optional part of libcdi
libcdi_la_USE_FC_extra_sources = \ libcdi_la_USE_FC_extra_sources = \
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
/* Define if building universal (internal helper macro) */ /* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD #undef AC_APPLE_UNIVERSAL_BUILD
/* CDI version */
#undef CDI
/* Compiler */ /* Compiler */
#undef COMPILER #undef COMPILER
......
#ifndef EXSE_H
#define EXSE_H
enum {
EXSE_SINGLE_PRECISION = 4,
EXSE_DOUBLE_PRECISION = 8,
};
#endif
...@@ -3,17 +3,17 @@ ...@@ -3,17 +3,17 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include "dmemory.h" #include "dmemory.h"
#include "extra.h" #include "extra.h"
#include "error.h" #include "error.h"
#include "file.h" #include "file.h"
#include "binary.h" #include "binary.h"
#include "stream_fcommon.h" #include "exse.h"
#include "swap.h" #include "swap.h"
...@@ -30,16 +30,15 @@ static int extDefaultNumber = EXT_REAL; ...@@ -30,16 +30,15 @@ static int extDefaultNumber = EXT_REAL;
/* /*
* A version string. * A version string.
*/ */
#undef LIBVERSION #undef LIBVERSION
#define LIBVERSION 1.3.2 #define LIBVERSION 1.4.0
#define XSTRING(x) #x #define XSTRING(x) #x
#define STRING(x) XSTRING(x) #define STRING(x) XSTRING(x)
static const char ext_libvers[] = STRING(LIBVERSION) " of " __DATE__ " " __TIME__ ; static const char ext_libvers[] = STRING(LIBVERSION) " of " __DATE__ " " __TIME__ ;
const char *extLibraryVersion(void) const char *extLibraryVersion(void)
{ {
return (ext_libvers); return ext_libvers;
} }
...@@ -55,13 +54,12 @@ void extDebug(int debug) ...@@ -55,13 +54,12 @@ void extDebug(int debug)
} }
static void extLibInit() static
void extLibInit()
{ {
char *envString;
const char *envName = "EXT_PRECISION"; const char *envName = "EXT_PRECISION";
char *envString = getenv(envName);
envString = getenv(envName);
if ( envString ) if ( envString )
{ {
int pos = 0; int pos = 0;
...@@ -75,8 +73,8 @@ static void extLibInit() ...@@ -75,8 +73,8 @@ static void extLibInit()
extDefaultNumber = EXT_REAL; extDefaultNumber = EXT_REAL;
switch ( (int) envString[pos+1] ) switch ( (int) envString[pos+1] )
{ {
case '4': extDefaultPrec = SINGLE_PRECISION; break; case '4': extDefaultPrec = EXSE_SINGLE_PRECISION; break;
case '8': extDefaultPrec = DOUBLE_PRECISION; break; case '8': extDefaultPrec = EXSE_DOUBLE_PRECISION; break;
default: default:
Message("Invalid digit in %s: %s", envName, envString); Message("Invalid digit in %s: %s", envName, envString);
} }
...@@ -87,8 +85,8 @@ static void extLibInit() ...@@ -87,8 +85,8 @@ static void extLibInit()
extDefaultNumber = EXT_COMP; extDefaultNumber = EXT_COMP;
switch ( (int) envString[pos+1] ) switch ( (int) envString[pos+1] )
{ {
case '4': extDefaultPrec = SINGLE_PRECISION; break; case '4': extDefaultPrec = EXSE_SINGLE_PRECISION; break;
case '8': extDefaultPrec = DOUBLE_PRECISION; break; case '8': extDefaultPrec = EXSE_DOUBLE_PRECISION; break;
default: default:
Message("Invalid digit in %s: %s", envName, envString); Message("Invalid digit in %s: %s", envName, envString);
} }
...@@ -121,15 +119,13 @@ void extInit(extrec_t *extp) ...@@ -121,15 +119,13 @@ void extInit(extrec_t *extp)
void *extNew(void) void *extNew(void)
{ {
extrec_t *extp;
if ( ! initExtLib ) extLibInit(); if ( ! initExtLib ) extLibInit();
extp = (extrec_t *) Malloc(sizeof(extrec_t)); extrec_t *extp = (extrec_t *) Malloc(sizeof(extrec_t));
extInit(extp); extInit(extp);
return ((void*)extp); return (void*)extp;
} }
...@@ -147,17 +143,16 @@ void extDelete(void *ext) ...@@ -147,17 +143,16 @@ void extDelete(void *ext)
int extCheckFiletype(int fileID, int *swap) int extCheckFiletype(int fileID, int *swap)
{ {
size_t blocklen = 0, fact = 0; size_t fact = 0;
size_t sblocklen = 0;
size_t data = 0; size_t data = 0;
size_t dimxy = 0; size_t dimxy = 0;
int found = 0; int found = 0;
unsigned char buffer[40], *pbuf; unsigned char buffer[40], *pbuf;
if ( fileRead(fileID, buffer, 4) != 4 ) return (found); if ( fileRead(fileID, buffer, 4) != 4 ) return found;
blocklen = (size_t) get_UINT32(buffer); size_t blocklen = (size_t) get_UINT32(buffer);
sblocklen = (size_t) get_SUINT32(buffer); size_t sblocklen = (size_t) get_SUINT32(buffer);
if ( EXT_Debug ) if ( EXT_Debug )
Message("blocklen = %d sblocklen = %d", blocklen, sblocklen); Message("blocklen = %d sblocklen = %d", blocklen, sblocklen);
...@@ -166,7 +161,7 @@ int extCheckFiletype(int fileID, int *swap) ...@@ -166,7 +161,7 @@ int extCheckFiletype(int fileID, int *swap)
{ {
*swap = 0; *swap = 0;
fact = blocklen/4; fact = blocklen/4;
if ( fileRead(fileID, buffer, blocklen+8) != blocklen+8 ) return (found); if ( fileRead(fileID, buffer, blocklen+8) != blocklen+8 ) return found;
pbuf = buffer+3*fact; dimxy = (size_t) get_UINT32(pbuf); pbuf = buffer+3*fact; dimxy = (size_t) get_UINT32(pbuf);
pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf);
} }
...@@ -174,7 +169,7 @@ int extCheckFiletype(int fileID, int *swap) ...@@ -174,7 +169,7 @@ int extCheckFiletype(int fileID, int *swap)
{ {
*swap = 0; *swap = 0;
fact = blocklen/4; fact = blocklen/4;
if ( fileRead(fileID, buffer, blocklen+8) != blocklen+8 ) return (found); if ( fileRead(fileID, buffer, blocklen+8) != blocklen+8 ) return found;
pbuf = buffer+3*fact; dimxy = (size_t) get_UINT64(pbuf); pbuf = buffer+3*fact; dimxy = (size_t) get_UINT64(pbuf);
pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf);
} }
...@@ -182,7 +177,7 @@ int extCheckFiletype(int fileID, int *swap) ...@@ -182,7 +177,7 @@ int extCheckFiletype(int fileID, int *swap)
{ {
*swap = 1; *swap = 1;
fact = sblocklen/4; fact = sblocklen/4;
if ( fileRead(fileID, buffer, sblocklen+8) != sblocklen+8 ) return (found); if ( fileRead(fileID, buffer, sblocklen+8) != sblocklen+8 ) return found;
pbuf = buffer+3*fact; dimxy = (size_t) get_SUINT32(pbuf); pbuf = buffer+3*fact; dimxy = (size_t) get_SUINT32(pbuf);
pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf);
} }
...@@ -190,7 +185,7 @@ int extCheckFiletype(int fileID, int *swap) ...@@ -190,7 +185,7 @@ int extCheckFiletype(int fileID, int *swap)
{ {
*swap = 1; *swap = 1;
fact = sblocklen/4; fact = sblocklen/4;
if ( fileRead(fileID, buffer, sblocklen+8) != sblocklen+8 ) return (found); if ( fileRead(fileID, buffer, sblocklen+8) != sblocklen+8 ) return found;
pbuf = buffer+3*fact; dimxy = (size_t) get_SUINT64(pbuf); pbuf = buffer+3*fact; dimxy = (size_t) get_SUINT64(pbuf);
pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf);
} }
...@@ -206,30 +201,28 @@ int extCheckFiletype(int fileID, int *swap) ...@@ -206,30 +201,28 @@ int extCheckFiletype(int fileID, int *swap)
Message("dimxy = %lu data = %lu", dimxy, data); Message("dimxy = %lu data = %lu", dimxy, data);
} }
return (found); return found;
} }
int extInqHeader(void *ext, int *header) int extInqHeader(void *ext, int *header)
{ {
extrec_t *extp = (extrec_t *) ext; extrec_t *extp = (extrec_t *) ext;
size_t i;
for ( i = 0; i < EXT_HEADER_LEN; i++ ) for ( size_t i = 0; i < EXT_HEADER_LEN; i++ )
header[i] = extp->header[i]; header[i] = extp->header[i];
if ( EXT_Debug ) Message("datasize = %lu", extp->datasize); if ( EXT_Debug ) Message("datasize = %lu", extp->datasize);
return (0); return 0;
} }
int extDefHeader(void *ext, const int *header) int extDefHeader(void *ext, const int *header)
{ {
extrec_t *extp = (extrec_t *) ext; extrec_t *extp = (extrec_t *) ext;
size_t i;
for ( i = 0; i < EXT_HEADER_LEN; i++ ) for ( size_t i = 0; i < EXT_HEADER_LEN; i++ )
extp->header[i] = header[i]; extp->header[i] = header[i];
extp->datasize = (size_t)header[3]; extp->datasize = (size_t)header[3];
...@@ -237,26 +230,22 @@ int extDefHeader(void *ext, const int *header) ...@@ -237,26 +230,22 @@ int extDefHeader(void *ext, const int *header)
if ( EXT_Debug ) Message("datasize = %lu", extp->datasize); if ( EXT_Debug ) Message("datasize = %lu", extp->datasize);
return (0); return 0;
} }
static
static int extInqData(extrec_t *extp, int prec, void *data) int extInqData(extrec_t *extp, int prec, void *data)
{ {
size_t datasize;
size_t i; size_t i;
int ierr = 0; int ierr = 0;
int rprec;
void *buffer;
int byteswap = extp->byteswap; int byteswap = extp->byteswap;
size_t datasize = extp->datasize;
datasize = extp->datasize; void *buffer = extp->buffer;
buffer = extp->buffer; int rprec = extp->prec;
rprec = extp->prec;
switch ( rprec ) switch ( rprec )
{ {
case SINGLE_PRECISION: case EXSE_SINGLE_PRECISION:
{ {
if ( sizeof(FLT32) == 4 ) if ( sizeof(FLT32) == 4 )
{ {
...@@ -274,7 +263,7 @@ static int extInqData(extrec_t *extp, int prec, void *data) ...@@ -274,7 +263,7 @@ static int extInqData(extrec_t *extp, int prec, void *data)
} }
break; break;
} }
case DOUBLE_PRECISION: case EXSE_DOUBLE_PRECISION:
if ( sizeof(FLT64) == 8 ) if ( sizeof(FLT64) == 8 )
{ {
if ( byteswap ) swap8byte(buffer, datasize); if ( byteswap ) swap8byte(buffer, datasize);
...@@ -297,31 +286,27 @@ static int extInqData(extrec_t *extp, int prec, void *data) ...@@ -297,31 +286,27 @@ static int extInqData(extrec_t *extp, int prec, void *data)
} }
} }
return (ierr); return ierr;
} }
int extInqDataSP(void *ext, float *data) int extInqDataSP(void *ext, float *data)
{ {
return (extInqData((extrec_t *)ext, SINGLE_PRECISION, (void *) data)); return extInqData((extrec_t *)ext, EXSE_SINGLE_PRECISION, (void *) data);
} }
int extInqDataDP(void *ext, double *data) int extInqDataDP(void *ext, double *data)
{ {
return (extInqData((extrec_t *)ext, DOUBLE_PRECISION, (void *) data)); return extInqData((extrec_t *)ext, EXSE_DOUBLE_PRECISION, (void *) data);
} }
int extDefData(void *ext, int prec, const void *data) int extDefData(void *ext, int prec, const void *data)
{ {
extrec_t *extp = (extrec_t *) ext; extrec_t *extp = (extrec_t *) ext;
size_t datasize;
size_t blocklen;
size_t buffersize;
size_t i; size_t i;
int rprec; int rprec;
int *header;
void *buffer; void *buffer;
if ( extDefaultPrec ) rprec = extDefaultPrec; if ( extDefaultPrec ) rprec = extDefaultPrec;
...@@ -331,15 +316,15 @@ int extDefData(void *ext, int prec, const void *data) ...@@ -331,15 +316,15 @@ int extDefData(void *ext, int prec, const void *data)
extp->prec = rprec; extp->prec = rprec;
header = extp->header; int *header = extp->header;
datasize = (size_t)header[3]; size_t datasize = (size_t)header[3];
if ( extp->number == EXT_COMP ) datasize *= 2; if ( extp->number == EXT_COMP ) datasize *= 2;
blocklen = datasize * (size_t)rprec; size_t blocklen = datasize * (size_t)rprec;
extp->datasize = datasize; extp->datasize = datasize;
buffersize = extp->buffersize; size_t buffersize = extp->buffersize;
if ( buffersize != blocklen ) if ( buffersize != blocklen )
{ {
...@@ -354,22 +339,22 @@ int extDefData(void *ext, int prec, const void *data) ...@@ -354,22 +339,22 @@ int extDefData(void *ext, int prec, const void *data)
switch ( rprec ) switch ( rprec )
{ {
case SINGLE_PRECISION: case EXSE_SINGLE_PRECISION:
{ {
if ( rprec == prec ) if ( rprec == prec )
memcpy(buffer, data, datasize*sizeof(FLT32)); memcpy(buffer, data, datasize*sizeof(FLT32));
else else
for (i = 0; i < datasize; i++) for ( i = 0; i < datasize; i++ )
((float *) buffer)[i] = (float) ((double *) data)[i]; ((float *) buffer)[i] = (float) ((double *) data)[i];
break; break;
} }
case DOUBLE_PRECISION: case EXSE_DOUBLE_PRECISION:
{ {
if ( rprec == prec ) if ( rprec == prec )
memcpy(buffer, data, datasize*sizeof(FLT64)); memcpy(buffer, data, datasize*sizeof(FLT64));
else else
for (i = 0; i < datasize; i++) for ( i = 0; i < datasize; i++ )
((double *) buffer)[i] = (double) ((float *) data)[i];