Commit 768fba80 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

EXSE lib update

parent 23f64cf5
2009-12-29 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* using EXSE library version 1.2.0
2009-12-15 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de> 2009-12-15 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* fileRead: check result of fread * fileRead: check result of fread
......
...@@ -112,7 +112,7 @@ void usage(void) ...@@ -112,7 +112,7 @@ void usage(void)
static static
void printInfo(int gridtype, int vdate, int vtime, char *varname, double level, void printInfo(int gridtype, int vdate, int vtime, char *varname, double level,
int datasize, int nmiss, double missval, const double *data, int vardis) int datasize, int number, int nmiss, double missval, const double *data, int vardis)
{ {
static int rec = 0; static int rec = 0;
int i, ivals = 0, imiss = 0; int i, ivals = 0, imiss = 0;
...@@ -124,11 +124,11 @@ void printInfo(int gridtype, int vdate, int vtime, char *varname, double level, ...@@ -124,11 +124,11 @@ void printInfo(int gridtype, int vdate, int vtime, char *varname, double level,
if ( vardis ) if ( vardis )
fprintf(stdout, fprintf(stdout,
" Rec : Date Time Varname Level Size Miss : Minimum Mean Maximum\n"); " Rec : Date Time Varname Level Size Miss : Minimum Mean Maximum\n");
/* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+ */ /* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+ */
else else
fprintf(stdout, fprintf(stdout,
" Rec : Date Time Param Level Size Miss : Minimum Mean Maximum\n"); " Rec : Date Time Param Level Size Miss : Minimum Mean Maximum\n");
/* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+ */ /* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+ */
} }
date2str(vdate, vdatestr, sizeof(vdatestr)); date2str(vdate, vdatestr, sizeof(vdatestr));
...@@ -139,6 +139,7 @@ void printInfo(int gridtype, int vdate, int vtime, char *varname, double level, ...@@ -139,6 +139,7 @@ void printInfo(int gridtype, int vdate, int vtime, char *varname, double level,
fprintf(stdout, "%7d ", datasize); fprintf(stdout, "%7d ", datasize);
fprintf(stdout, "%7d :", nmiss); fprintf(stdout, "%7d :", nmiss);
/* /*
if ( gridtype == GRID_SPECTRAL ) if ( gridtype == GRID_SPECTRAL )
{ {
...@@ -146,6 +147,7 @@ void printInfo(int gridtype, int vdate, int vtime, char *varname, double level, ...@@ -146,6 +147,7 @@ void printInfo(int gridtype, int vdate, int vtime, char *varname, double level,
} }
else else
*/ */
if ( number == CDI_REAL )
{ {
if ( nmiss > 0 ) if ( nmiss > 0 )
{ {
...@@ -185,6 +187,31 @@ void printInfo(int gridtype, int vdate, int vtime, char *varname, double level, ...@@ -185,6 +187,31 @@ void printInfo(int gridtype, int vdate, int vtime, char *varname, double level,
if ( imiss != nmiss && nmiss > 0 ) if ( imiss != nmiss && nmiss > 0 )
fprintf(stdout, "Found %d of %d missing values!\n", imiss, nmiss); fprintf(stdout, "Found %d of %d missing values!\n", imiss, nmiss);
} }
else
{
int nvals_r = 0, nvals_i = 0;
double arrsum_r, arrsum_i, arrmean_r = 0, arrmean_i = 0;
arrsum_r = 0;
arrsum_i = 0;
for ( i = 0; i < datasize; i++ )
{
if ( !DBL_IS_EQUAL(data[i*2], missval) )
{
arrsum_r += data[i*2];
nvals_r++;
}
if ( !DBL_IS_EQUAL(data[i*2+1], missval) )
{
arrsum_i += data[i*2+1];
nvals_i++;
}
}
if ( nvals_r > 0 ) arrmean_r = arrsum_r / nvals_r;
if ( nvals_i > 0 ) arrmean_i = arrsum_i / nvals_i;
fprintf(stdout, " - (%#12.5g,%#12.5g) -\n", arrmean_r, arrmean_i);
}
} }
...@@ -207,7 +234,7 @@ void printShortinfo(int streamID, int vlistID, int vardis) ...@@ -207,7 +234,7 @@ void printShortinfo(int streamID, int vlistID, int vardis)
char units[128]; char units[128];
double level; double level;
char *modelptr, *instptr; char *modelptr, *instptr;
int prec; int prec, number;
int year, month, day, hour, minute, second; int year, month, day, hour, minute, second;
char pstr[4]; char pstr[4];
char paramstr[32]; char paramstr[32];
...@@ -265,17 +292,27 @@ void printShortinfo(int streamID, int vlistID, int vardis) ...@@ -265,17 +292,27 @@ void printShortinfo(int streamID, int vlistID, int vardis)
fprintf(stdout, "var "); fprintf(stdout, "var ");
prec = vlistInqVarDatatype(vlistID, varID); prec = vlistInqVarDatatype(vlistID, varID);
if ( prec == DATATYPE_PACK ) strcpy(pstr, "P0"); number = vlistInqVarNumber(vlistID, varID);
else if ( prec > 0 && prec <= 32 ) sprintf(pstr, "P%d", prec); if ( number == CDI_REAL )
else if ( prec == DATATYPE_FLT32 ) strcpy(pstr, "F32"); {
else if ( prec == DATATYPE_FLT64 ) strcpy(pstr, "F64"); if ( prec == DATATYPE_PACK ) strcpy(pstr, "P0");
else if ( prec == DATATYPE_INT8 ) strcpy(pstr, "I8"); else if ( prec > 0 && prec <= 32 ) sprintf(pstr, "P%d", prec);
else if ( prec == DATATYPE_INT16 ) strcpy(pstr, "I16"); else if ( prec == DATATYPE_FLT32 ) strcpy(pstr, "F32");
else if ( prec == DATATYPE_INT32 ) strcpy(pstr, "I32"); else if ( prec == DATATYPE_FLT64 ) strcpy(pstr, "F64");
else if ( prec == DATATYPE_UINT8 ) strcpy(pstr, "U8"); else if ( prec == DATATYPE_INT8 ) strcpy(pstr, "I8");
else if ( prec == DATATYPE_UINT16 ) strcpy(pstr, "U16"); else if ( prec == DATATYPE_INT16 ) strcpy(pstr, "I16");
else if ( prec == DATATYPE_UINT32 ) strcpy(pstr, "U32"); else if ( prec == DATATYPE_INT32 ) strcpy(pstr, "I32");
else strcpy(pstr, "-1"); else if ( prec == DATATYPE_UINT8 ) strcpy(pstr, "U8");
else if ( prec == DATATYPE_UINT16 ) strcpy(pstr, "U16");
else if ( prec == DATATYPE_UINT32 ) strcpy(pstr, "U32");
else strcpy(pstr, "-1");
}
else
{
if ( prec == DATATYPE_FLT32 ) strcpy(pstr, "C32");
else if ( prec == DATATYPE_FLT64 ) strcpy(pstr, "C64");
else strcpy(pstr, "-2");
}
fprintf(stdout, " %-3s", pstr); fprintf(stdout, " %-3s", pstr);
...@@ -746,7 +783,7 @@ int main(int argc, char *argv[]) ...@@ -746,7 +783,7 @@ int main(int argc, char *argv[])
int nrecs, nvars; int nrecs, nvars;
int levelID, levelsize; int levelID, levelsize;
int nts = 0; int nts = 0;
int gridsize = 0; int gridsize = 0, number;
int recID; int recID;
int tsID; int tsID;
int ntsteps = 0; int ntsteps = 0;
...@@ -816,7 +853,8 @@ int main(int argc, char *argv[]) ...@@ -816,7 +853,8 @@ int main(int argc, char *argv[])
if ( otableID == CDI_UNDEFID ) otableID = itableID; if ( otableID == CDI_UNDEFID ) otableID = itableID;
} }
if ( vlistNumber(vlistID1) != CDI_REAL ) datasize *= 2;
data = (double *) malloc(datasize*sizeof(double)); data = (double *) malloc(datasize*sizeof(double));
/* /*
...@@ -873,9 +911,10 @@ int main(int argc, char *argv[]) ...@@ -873,9 +911,10 @@ int main(int argc, char *argv[])
gridsize = gridInqSize(gridID); gridsize = gridInqSize(gridID);
level = zaxisInqLevel(zaxisID, levelID); level = zaxisInqLevel(zaxisID, levelID);
missval = vlistInqVarMissval(vlistID1, varID); missval = vlistInqVarMissval(vlistID1, varID);
number = vlistInqVarNumber(vlistID1, varID);
if ( Info ) if ( Info )
printInfo(gridtype, vdate, vtime, varname, level, gridsize, nmiss, missval, data, Vardis); printInfo(gridtype, vdate, vtime, varname, level, gridsize, number, nmiss, missval, data, Vardis);
if ( fname2 ) if ( fname2 )
{ {
...@@ -912,6 +951,7 @@ int main(int argc, char *argv[]) ...@@ -912,6 +951,7 @@ int main(int argc, char *argv[])
gridtype = gridInqType(gridID); gridtype = gridInqType(gridID);
gridsize = gridInqSize(gridID); gridsize = gridInqSize(gridID);
missval = vlistInqVarMissval(vlistID1, varID); missval = vlistInqVarMissval(vlistID1, varID);
number = vlistInqVarNumber(vlistID1, varID);
levelsize = zaxisInqSize(zaxisID); levelsize = zaxisInqSize(zaxisID);
for ( levelID = 0; levelID < levelsize; levelID++ ) for ( levelID = 0; levelID < levelsize; levelID++ )
...@@ -920,7 +960,7 @@ int main(int argc, char *argv[]) ...@@ -920,7 +960,7 @@ int main(int argc, char *argv[])
streamReadVarSlice(streamID1, varID, levelID, data, &nmiss); streamReadVarSlice(streamID1, varID, levelID, data, &nmiss);
if ( Info ) if ( Info )
printInfo(gridtype, vdate, vtime, varname, level, gridsize, nmiss, missval, data, Vardis); printInfo(gridtype, vdate, vtime, varname, level, gridsize, number, nmiss, missval, data, Vardis);
if ( fname2 ) if ( fname2 )
streamWriteVarSlice(streamID2, varID, levelID, data, nmiss); streamWriteVarSlice(streamID2, varID, levelID, data, nmiss);
......
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for cdi 1.4.1. # Generated by GNU Autoconf 2.61 for cdi 1.4.2.
# #
# Report bugs to <Uwe.Schulzweida@zmaw.de>. # Report bugs to <Uwe.Schulzweida@zmaw.de>.
# #
...@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} ...@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package. # Identity of this package.
PACKAGE_NAME='cdi' PACKAGE_NAME='cdi'
PACKAGE_TARNAME='cdi' PACKAGE_TARNAME='cdi'
PACKAGE_VERSION='1.4.1' PACKAGE_VERSION='1.4.2'
PACKAGE_STRING='cdi 1.4.1' PACKAGE_STRING='cdi 1.4.2'
PACKAGE_BUGREPORT='Uwe.Schulzweida@zmaw.de' PACKAGE_BUGREPORT='Uwe.Schulzweida@zmaw.de'
# Factoring default headers for most tests. # Factoring default headers for most tests.
...@@ -1258,7 +1258,7 @@ if test "$ac_init_help" = "long"; then ...@@ -1258,7 +1258,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures cdi 1.4.1 to adapt to many kinds of systems. \`configure' configures cdi 1.4.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
...@@ -1329,7 +1329,7 @@ fi ...@@ -1329,7 +1329,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of cdi 1.4.1:";; short | recursive ) echo "Configuration of cdi 1.4.2:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
...@@ -1462,7 +1462,7 @@ fi ...@@ -1462,7 +1462,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
cdi configure 1.4.1 cdi configure 1.4.2
generated by GNU Autoconf 2.61 generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
...@@ -1476,7 +1476,7 @@ cat >config.log <<_ACEOF ...@@ -1476,7 +1476,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by cdi $as_me 1.4.1, which was It was created by cdi $as_me 1.4.2, which was
generated by GNU Autoconf 2.61. Invocation command line was generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@ $ $0 $@
...@@ -2303,7 +2303,7 @@ fi ...@@ -2303,7 +2303,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='cdi' PACKAGE='cdi'
VERSION='1.4.1' VERSION='1.4.2'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
...@@ -9031,7 +9031,7 @@ exec 6>&1 ...@@ -9031,7 +9031,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by cdi $as_me 1.4.1, which was This file was extended by cdi $as_me 1.4.2, which was
generated by GNU Autoconf 2.61. Invocation command line was generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
...@@ -9084,7 +9084,7 @@ Report bugs to <bug-autoconf@gnu.org>." ...@@ -9084,7 +9084,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\ ac_cs_version="\\
cdi config.status 1.4.1 cdi config.status 1.4.2
configured by $0, generated by GNU Autoconf 2.61, configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
......
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_INIT(cdi, 1.4.1, Uwe.Schulzweida@zmaw.de) AC_INIT(cdi, 1.4.2, Uwe.Schulzweida@zmaw.de)
echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}" echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"
......
...@@ -16,6 +16,10 @@ extern "C" { ...@@ -16,6 +16,10 @@ extern "C" {
#define CDI_BIGENDIAN 0 /* Byte order BIGENDIAN */ #define CDI_BIGENDIAN 0 /* Byte order BIGENDIAN */
#define CDI_LITTLEENDIAN 1 /* Byte order LITTLEENDIAN */ #define CDI_LITTLEENDIAN 1 /* Byte order LITTLEENDIAN */
#define CDI_REAL 1 /* Real numbers */
#define CDI_COMP 2 /* Complex numbers */
#define CDI_BOTH 3 /* Both numbers */
/* Error identifier */ /* Error identifier */
#define CDI_NOERR 0 /* No Error */ #define CDI_NOERR 0 /* No Error */
...@@ -297,6 +301,9 @@ void vlistMerge(int vlistID2, int vlistID1); ...@@ -297,6 +301,9 @@ void vlistMerge(int vlistID2, int vlistID1);
void vlistPrint(int vlistID); void vlistPrint(int vlistID);
/* vlistNumber: Number type in a variable list */
int vlistNumber(int vlistID);
/* vlistNvars: Number of variables in a variable list */ /* vlistNvars: Number of variables in a variable list */
int vlistNvars(int vlistID); int vlistNvars(int vlistID);
...@@ -369,6 +376,12 @@ void vlistDefVarDatatype(int vlistID, int varID, int datatype); ...@@ -369,6 +376,12 @@ void vlistDefVarDatatype(int vlistID, int varID, int datatype);
/* vlistInqVarDatatype: Get the data type of a Variable */ /* vlistInqVarDatatype: Get the data type of a Variable */
int vlistInqVarDatatype(int vlistID, int varID); int vlistInqVarDatatype(int vlistID, int varID);
/* vlistDefVarNumber: Define the number type of a Variable */
void vlistDefVarNumber(int vlistID, int varID, int number);
/* vlistInqVarNumber: Get the number type of a Variable */
int vlistInqVarNumber(int vlistID, int varID);
void vlistDefVarInstitut(int vlistID, int varID, int instID); void vlistDefVarInstitut(int vlistID, int varID, int instID);
int vlistInqVarInstitut(int vlistID, int varID); int vlistInqVarInstitut(int vlistID, int varID);
void vlistDefVarModel(int vlistID, int varID, int modelID); void vlistDefVarModel(int vlistID, int varID, int modelID);
......
#ifndef _EXTRA_H #ifndef _EXTRA_H
#define _EXTRA_H #define _EXTRA_H
#define EXT_REAL 1
#define EXT_COMP 2
typedef struct { typedef struct {
int checked; int checked;
int byteswap; int byteswap;
int header[4]; int header[4];
int hprec; /* header precision */ int prec; /* single or double precison */
int dprec; /* data precision */ int number; /* real or complex */
size_t datasize; size_t datasize;
size_t buffersize; size_t buffersize;
void *buffer; void *buffer;
} }
EXTREC; extrec_t;
const char *extLibraryVersion(void); const char *extLibraryVersion(void);
...@@ -21,18 +24,18 @@ void extDebug(int debug); ...@@ -21,18 +24,18 @@ void extDebug(int debug);
int extCheckFiletype(int fileID, int *swap); int extCheckFiletype(int fileID, int *swap);
EXTREC *extNew(void); void *extNew(void);
void extDelete(EXTREC *extp); void extDelete(void *ext);
int extRead(int fileID, EXTREC *extp); int extRead(int fileID, void *ext);
int extWrite(int fileID, EXTREC *extp); int extWrite(int fileID, void *ext);
int extInqHeader(EXTREC *extp, int *header); int extInqHeader(void *ext, int *header);
int extInqDataSP(EXTREC *extp, float *data); int extInqDataSP(void *ext, float *data);
int extInqDataDP(EXTREC *extp, double *data); int extInqDataDP(void *ext, double *data);
int extDefHeader(EXTREC *extp, const int *header); int extDefHeader(void *ext, const int *header);
int extDefDataSP(EXTREC *extp, const float *data); int extDefDataSP(void *ext, const float *data);
int extDefDataDP(EXTREC *extp, const double *data); int extDefDataDP(void *ext, const double *data);
#endif /* _EXTRA_H */ #endif /* _EXTRA_H */
...@@ -16,15 +16,15 @@ ...@@ -16,15 +16,15 @@
#include "swap.h" #include "swap.h"
#define SINGLE_PRECISION 4 #define SINGLE_PRECISION 4
#define DOUBLE_PRECISION 8 #define DOUBLE_PRECISION 8
#define EXT_HEADER_LEN 4 #define EXT_HEADER_LEN 4
static int initExtLib = 0; static int initExtLib = 0;
static int extDefaultHprec = 0; static int extDefaultPrec = 0;
static int extDefaultDprec = 0; static int extDefaultNumber = EXT_REAL;
/* /*
...@@ -32,7 +32,7 @@ static int extDefaultDprec = 0; ...@@ -32,7 +32,7 @@ static int extDefaultDprec = 0;
*/ */
#undef LIBVERSION #undef LIBVERSION
#define LIBVERSION 1.0.2 #define LIBVERSION 1.2.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__;
...@@ -67,33 +67,31 @@ void extLibInit() ...@@ -67,33 +67,31 @@ void extLibInit()
envString = getenv(envName); envString = getenv(envName);
if ( envString ) if ( envString )
{ {
int pos; int pos = 0;
int nrun;
if ( strlen(envString) == 2 ) nrun = 1;
else nrun = 2;
pos = 0; if ( strlen(envString) == 2 )
while ( nrun-- )
{ {
switch ( tolower((int) envString[pos]) ) switch ( tolower((int) envString[pos]) )
{ {
case 'i': case 'r':
{ {
extDefaultNumber = EXT_REAL;
switch ( (int) envString[pos+1] ) switch ( (int) envString[pos+1] )
{ {
case '4': extDefaultHprec = SINGLE_PRECISION; break; case '4': extDefaultPrec = SINGLE_PRECISION; break;
case '8': extDefaultHprec = DOUBLE_PRECISION; break; case '8': extDefaultPrec = DOUBLE_PRECISION; break;
default: default:
Message(func, "Invalid digit in %s: %s", envName, envString); Message(func, "Invalid digit in %s: %s", envName, envString);
} }
break; break;
} }
case 'r': case 'c':
{ {
extDefaultNumber = EXT_COMP;
switch ( (int) envString[pos+1] ) switch ( (int) envString[pos+1] )
{ {
case '4': extDefaultDprec = SINGLE_PRECISION; break; case '4': extDefaultPrec = SINGLE_PRECISION; break;
case '8': extDefaultDprec = DOUBLE_PRECISION; break; case '8': extDefaultPrec = DOUBLE_PRECISION; break;
default: default:
Message(func, "Invalid digit in %s: %s", envName, envString); Message(func, "Invalid digit in %s: %s", envName, envString);
} }
...@@ -102,44 +100,44 @@ void extLibInit() ...@@ -102,44 +100,44 @@ void extLibInit()
default: default:
Message(func, "Invalid character in %s: %s", envName, envString); Message(func, "Invalid character in %s: %s", envName, envString);
} }
pos += 2;
} }
} }
initExtLib = 1; initExtLib = 1;
} }
static
void extInit(EXTREC *extp) void extInit(extrec_t *extp)
{ {
extp->checked = 0; extp->checked = 0;
extp->byteswap = 0; extp->byteswap = 0;
extp->hprec = 0; extp->prec = 0;
extp->dprec = 0; extp->number = extDefaultNumber;
extp->datasize = 0; extp->datasize = 0;
extp->buffersize = 0; extp->buffersize = 0;
extp->buffer = NULL; extp->buffer = NULL;
} }
EXTREC *extNew(void) void *extNew(void)
{ {
static char func[] = "extNew"; static char func[] = "extNew";
EXTREC *extp; extrec_t *extp;