Commit f4907aca authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

stream_ext.c: changed all stream arguments to type stream_t

parent af8fae1e
......@@ -561,7 +561,7 @@ int cdiInqContents(int streamID)
#if defined (HAVE_LIBEXTRA)
case FILETYPE_EXT:
{
status = extInqContents(streamID);
status = extInqContents(streamptr);
break;
}
#endif
......@@ -1517,7 +1517,7 @@ int streamInqTimestep(int streamID, int tsID)
#if defined (HAVE_LIBEXTRA)
case FILETYPE_EXT:
{
nrecs = extInqTimestep(streamID, tsID);
nrecs = extInqTimestep(streamptr, tsID);
break;
}
#endif
......@@ -1609,7 +1609,7 @@ void streamReadVar(int streamID, int varID, double *data, int *nmiss)
#if defined (HAVE_LIBEXTRA)
case FILETYPE_EXT:
{
extReadVarDP(streamID, varID, data, nmiss);
extReadVarDP(streamptr, varID, data, nmiss);
break;
}
#endif
......@@ -1702,7 +1702,7 @@ void stream_write_var(int streamID, int varID, int memtype, const void *data, in
case FILETYPE_EXT:
{
if ( memtype == MEMTYPE_FLOAT ) Error("extWriteVar not implemented for memtype float!");
extWriteVarDP(streamID, varID, data);
extWriteVarDP(streamptr, varID, data);
break;
}
#endif
......@@ -1832,7 +1832,7 @@ void streamReadVarSlice(int streamID, int varID, int levelID, double *data, int
#if defined (HAVE_LIBEXTRA)
case FILETYPE_EXT:
{
extReadVarSliceDP(streamID, varID, levelID, data, nmiss);
extReadVarSliceDP(streamptr, varID, levelID, data, nmiss);
break;
}
#endif
......@@ -1901,7 +1901,7 @@ void stream_write_var_slice(int streamID, int varID, int levelID, int memtype, c
case FILETYPE_EXT:
{
if ( memtype == MEMTYPE_FLOAT ) Error("extWriteVarSlice not implemented for memtype float!");
extWriteVarSliceDP(streamID, varID, levelID, data);
extWriteVarSliceDP(streamptr, varID, levelID, data);
break;
}
#endif
......
......@@ -70,7 +70,7 @@ void extDefDatatype(int datatype, int *prec, int *number)
}
/* not used
int extInqRecord(int streamID, int *varID, int *levelID)
int extInqRecord(stream_t *streamptr, int *varID, int *levelID)
{
int status;
int fileID;
......@@ -79,11 +79,6 @@ int extInqRecord(int streamID, int *varID, int *levelID)
int header[4];
int vlistID;
extrec_t *extp;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
vlistID = streamptr->vlistID;
fileID = streamptr->fileID;
......@@ -107,12 +102,12 @@ int extInqRecord(int streamID, int *varID, int *levelID)
zaxisID = vlistInqVarZaxis(vlistID, *varID);
*levelID = zaxisInqLevelID(zaxisID, (double) ilevel);
return (1);
}
*/
int extReadRecord(int streamID, double *data, int *nmiss)
int extReadRecord(stream_t *streamptr, double *data, int *nmiss)
{
int vlistID, fileID;
int status;
......@@ -123,11 +118,6 @@ int extReadRecord(int streamID, double *data, int *nmiss)
int i, size;
double missval;
extrec_t *extp;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
vlistID = streamptr->vlistID;
fileID = streamptr->fileID;
......@@ -176,7 +166,7 @@ int extReadRecord(int streamID, double *data, int *nmiss)
}
int extCopyRecord(int streamID2, int streamID1)
int extCopyRecord(stream_t *streamptr2, stream_t *streamptr1)
{
int fileID1, fileID2;
int tsID, recID, vrecID;
......@@ -184,14 +174,6 @@ int extCopyRecord(int streamID2, int streamID1)
off_t recpos;
int status = 0;
char *buffer;
stream_t *streamptr1;
stream_t *streamptr2;
streamptr1 = stream_to_pointer(streamID1);
streamptr2 = stream_to_pointer(streamID2);
stream_check_ptr(__func__, streamptr1);
stream_check_ptr(__func__, streamptr2);
fileID1 = streamptr1->fileID;
fileID2 = streamptr2->fileID;
......@@ -216,18 +198,13 @@ int extCopyRecord(int streamID2, int streamID1)
}
int extDefRecord(int streamID)
int extDefRecord(stream_t *streamptr)
{
int gridID;
int header[4];
int status = 0;
int pdis, pcat, pnum;
extrec_t *extp;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
gridID = streamptr->record->gridID;
extp = streamptr->record->extp;
......@@ -246,16 +223,11 @@ int extDefRecord(int streamID)
}
int extWriteRecord(int streamID, const double *data)
int extWriteRecord(stream_t *streamptr, const double *data)
{
int fileID;
int status = 0;
extrec_t *extp;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
fileID = streamptr->fileID;
extp = streamptr->record->extp;
......@@ -268,7 +240,7 @@ int extWriteRecord(int streamID, const double *data)
}
static
void extAddRecord(int streamID, int param, int level, int xysize,
void extAddRecord(stream_t *streamptr, int param, int level, int xysize,
long recsize, off_t position, int prec, int number)
{
int leveltype;
......@@ -278,9 +250,6 @@ void extAddRecord(int streamID, int param, int level, int xysize,
record_t *record;
grid_t grid;
int vlistID;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
vlistID = streamptr->vlistID;
tsID = streamptr->curTsID;
......@@ -321,15 +290,12 @@ void extAddRecord(int streamID, int param, int level, int xysize,
}
void extCmpRecord(int streamID, int tsID, int recID, off_t position, int param,
void extCmpRecord(stream_t *streamptr, int tsID, int recID, off_t position, int param,
int level, int xysize)
{
int varID = 0;
int levelID = 0;
record_t *record;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
record = &streamptr->tsteps[tsID].records[recID];
......@@ -351,8 +317,8 @@ void extCmpRecord(int streamID, int tsID, int recID, off_t position, int param,
}
static
void extScanTimestep1(int streamID)
{
void extScanTimestep1(stream_t *streamptr)
{
int header[4];
int status;
int fileID;
......@@ -370,11 +336,6 @@ void extScanTimestep1(int streamID)
int vlistID;
extcompvar_t compVar, compVar0;
extrec_t *extp;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
streamptr->curTsID = 0;
......@@ -437,7 +398,7 @@ void extScanTimestep1(int streamID)
if ( CDI_Debug )
Message("%4d%8d%4d%8d%8d%6d", nrecs, (int)recpos, rcode, rlevel, vdate, vtime);
extAddRecord(streamID, param, rlevel, rxysize, recsize, recpos, extp->prec, extp->number);
extAddRecord(streamptr, param, rlevel, rxysize, recsize, recpos, extp->prec, extp->number);
}
streamptr->rtsteps = 1;
......@@ -491,7 +452,7 @@ void extScanTimestep1(int streamID)
}
static
int extScanTimestep2(int streamID)
int extScanTimestep2(stream_t *streamptr)
{
int header[4];
int status;
......@@ -509,11 +470,6 @@ int extScanTimestep2(int streamID)
int vlistID;
extcompvar_t compVar, compVar0;
extrec_t *extp;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
streamptr->curTsID = 1;
......@@ -655,23 +611,18 @@ int extScanTimestep2(int streamID)
}
int extInqContents(int streamID)
int extInqContents(stream_t *streamptr)
{
int fileID;
int status = 0;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
fileID = streamptr->fileID;
streamptr->curTsID = 0;
extScanTimestep1(streamID);
if ( streamptr->ntsteps == -1 ) status = extScanTimestep2(streamID);
extScanTimestep1(streamptr);
if ( streamptr->ntsteps == -1 ) status = extScanTimestep2(streamptr);
fileSetPos(fileID, 0, SEEK_SET);
......@@ -679,7 +630,7 @@ int extInqContents(int streamID)
}
static
int extScanTimestep(int streamID)
int extScanTimestep(stream_t *streamptr)
{
int header[4];
int status;
......@@ -695,15 +646,10 @@ int extScanTimestep(int streamID)
int rindex, nrecs = 0;
extcompvar_t compVar, compVar0;
extrec_t *extp;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
if ( CDI_Debug )
{
Message("streamID = %d", streamID);
Message("streamptr = %p", streamptr);
Message("cts = %d", streamptr->curTsID);
Message("rts = %d", streamptr->rtsteps);
Message("nts = %d", streamptr->ntsteps);
......@@ -763,7 +709,7 @@ int extScanTimestep(int streamID)
taxis->vtime = vtime;
}
/*
extCmpRecord(streamID, tsID, nrecs, recpos, param, rlevel, rxysize);
extCmpRecord(streamptr, tsID, nrecs, recpos, param, rlevel, rxysize);
*/
compVar.param = param;
compVar.level = rlevel;
......@@ -812,24 +758,19 @@ int extScanTimestep(int streamID)
}
int extInqTimestep(int streamID, int tsID)
int extInqTimestep(stream_t *streamptr, int tsID)
{
int ntsteps, nrecs;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
if ( tsID == 0 && streamptr->rtsteps == 0 )
Error("Call to cdiInqContents missing!");
if ( CDI_Debug )
Message("tsID = %d rtsteps = %d", tsID, streamptr->rtsteps);
ntsteps = UNDEFID;
while ( ( tsID + 1 ) > streamptr->rtsteps && ntsteps == UNDEFID )
ntsteps = extScanTimestep(streamID);
ntsteps = extScanTimestep(streamptr);
if ( tsID >= streamptr->ntsteps && streamptr->ntsteps != CDI_UNDEFID )
{
......@@ -845,7 +786,7 @@ int extInqTimestep(int streamID, int tsID)
}
void extReadVarDP(int streamID, int varID, double *data, int *nmiss)
void extReadVarDP(stream_t *streamptr, int varID, double *data, int *nmiss)
{
int vlistID, fileID;
int levID, nlevs, gridID, gridsize;
......@@ -856,9 +797,6 @@ void extReadVarDP(int streamID, int varID, double *data, int *nmiss)
int i;
double missval;
extrec_t *extp;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
extp = streamptr->record->extp;
vlistID = streamptr->vlistID;
......@@ -907,7 +845,7 @@ void extReadVarDP(int streamID, int varID, double *data, int *nmiss)
}
void extReadVarSliceDP(int streamID, int varID, int levID, double *data, int *nmiss)
void extReadVarSliceDP(stream_t *streamptr, int varID, int levID, double *data, int *nmiss)
{
int vlistID, fileID;
int nlevs, gridID, gridsize;
......@@ -918,9 +856,6 @@ void extReadVarSliceDP(int streamID, int varID, int levID, double *data, int *nm
int i;
double missval;
extrec_t *extp;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
extp = streamptr->record->extp;
vlistID = streamptr->vlistID;
......@@ -968,7 +903,7 @@ void extReadVarSliceDP(int streamID, int varID, int levID, double *data, int *nm
}
void extWriteVarDP(int streamID, int varID, const double *data)
void extWriteVarDP(stream_t *streamptr, int varID, const double *data)
{
int fileID;
int levID, nlevs, gridID, gridsize;
......@@ -979,12 +914,8 @@ void extWriteVarDP(int streamID, int varID, const double *data)
int vlistID;
int pdis, pcat, pnum;
extrec_t *extp;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
if ( CDI_Debug )
Message("streamID = %d varID = %d", streamID, varID);
if ( CDI_Debug ) Message("streamptr = %p varID = %d", streamptr, varID);
extp = streamptr->record->extp;
vlistID = streamptr->vlistID;
......@@ -1018,7 +949,7 @@ void extWriteVarDP(int streamID, int varID, const double *data)
}
void extWriteVarSliceDP(int streamID, int varID, int levID, const double *data)
void extWriteVarSliceDP(stream_t *streamptr, int varID, int levID, const double *data)
{
int fileID;
int gridID;
......@@ -1029,9 +960,6 @@ void extWriteVarSliceDP(int streamID, int varID, int levID, const double *data)
int vlistID;
int pdis, pcat, pnum;
extrec_t *extp;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
extp = streamptr->record->extp;
vlistID = streamptr->vlistID;
......
......@@ -5,20 +5,20 @@
# include "extra.h"
#endif
int extInqContents(int streamID);
int extInqTimestep(int streamID, int tsID);
int extInqContents(stream_t *streamptr);
int extInqTimestep(stream_t *streamptr, int tsID);
int extInqRecord(int streamID, int *varID, int *levelID);
int extDefRecord(int streamID);
int extCopyRecord(int streamIDdest, int streamIDsrc);
int extReadRecord(int streamID, double *data, int *nmiss);
int extWriteRecord(int streamID, const double *data);
int extInqRecord(stream_t *streamptr, int *varID, int *levelID);
int extDefRecord(stream_t *streamptr);
int extCopyRecord(stream_t *streamptr2, stream_t *streamptr1);
int extReadRecord(stream_t *streamptr, double *data, int *nmiss);
int extWriteRecord(stream_t *streamptr, const double *data);
void extReadVarDP (int streamID, int varID, double *data, int *nmiss);
void extWriteVarDP(int streamID, int varID, const double *data);
void extReadVarDP (stream_t *streamptr, int varID, double *data, int *nmiss);
void extWriteVarDP(stream_t *streamptr, int varID, const double *data);
void extReadVarSliceDP (int streamID, int varID, int levelID, double *data, int *nmiss);
void extWriteVarSliceDP(int streamID, int varID, int levelID, const double *data);
void extReadVarSliceDP (stream_t *streamptr, int varID, int levelID, double *data, int *nmiss);
void extWriteVarSliceDP(stream_t *streamptr, int varID, int levelID, const double *data);
#endif /* _STREAM_EXT_H */
/*
......
......@@ -259,7 +259,7 @@ void streamDefRecord(int streamID, int varID, int levelID)
#if defined (HAVE_LIBEXTRA)
case FILETYPE_EXT:
{
status = extDefRecord(streamID);
status = extDefRecord(streamptr);
break;
}
#endif
......@@ -327,7 +327,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
#if defined (HAVE_LIBEXTRA)
case FILETYPE_EXT:
{
status = extReadRecord(streamID, data, nmiss);
status = extReadRecord(streamptr, data, nmiss);
break;
}
#endif
......@@ -394,7 +394,7 @@ void stream_write_record(int streamID, int memtype, const void *data, int nmiss)
case FILETYPE_EXT:
{
if ( memtype == MEMTYPE_FLOAT ) Error("extWriteRecord not implemented for memtype float!");
status = extWriteRecord(streamID, data);
status = extWriteRecord(streamptr, data);
break;
}
#endif
......@@ -474,7 +474,7 @@ void streamCopyRecord(int streamID2, int streamID1)
#if defined (HAVE_LIBEXTRA)
case FILETYPE_EXT:
{
status = extCopyRecord(streamID2, streamID1);
status = extCopyRecord(streamptr2, streamptr1);
break;
}
#endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment