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

Moved function streamFCopyRecord() to stream_record.c.

parent 8b3cd3d3
......@@ -83,8 +83,6 @@ libcdi_la_SOURCES = \
stream_history.c \
stream_ieg.c \
stream_ieg.h \
stream_fcommon.c \
stream_fcommon.h \
cdi_int.c \
cdi_int.h \
stream_record.c \
......
......@@ -180,17 +180,16 @@ am__libcdi_la_SOURCES_DIST = basetime.c basetime.h binary.c binary.h \
resource_handle.h service.h servicelib.c stream_cdf.c \
stream_cdf.h stream_cgribex.c stream_cgribex.h stream_ext.c \
stream_ext.h stream_grb.c stream_grb.h stream_gribapi.h \
stream_history.c stream_ieg.c stream_ieg.h stream_fcommon.c \
stream_fcommon.h cdi_int.c cdi_int.h stream_record.c \
stream_srv.c stream_srv.h stream_var.c grb_write.c grb_read.c \
cdf_write.c cdf_read.c subtype.c subtype.h swap.h table.c \
table.h tablepar.h taxis.c taxis.h timebase.c timebase.h \
tsteps.c util.c varscan.c varscan.h version.c vlist.c vlist.h \
vlist_att.c vlist_att.h vlist_var.c vlist_var.h zaxis.c \
zaxis.h stream.c stream_write.c stream_read.c swap.c \
iterator.c iterator.h iterator_fallback.c iterator_fallback.h \
iterator_grib.c iterator_grib.h cfortran.h cdiFortran.c \
gribapi_utilities.c stream_gribapi.c
stream_history.c stream_ieg.c stream_ieg.h cdi_int.c cdi_int.h \
stream_record.c stream_srv.c stream_srv.h stream_var.c \
grb_write.c grb_read.c cdf_write.c cdf_read.c subtype.c \
subtype.h swap.h table.c table.h tablepar.h taxis.c taxis.h \
timebase.c timebase.h tsteps.c util.c varscan.c varscan.h \
version.c vlist.c vlist.h vlist_att.c vlist_att.h vlist_var.c \
vlist_var.h zaxis.c zaxis.h stream.c stream_write.c \
stream_read.c swap.c iterator.c iterator.h iterator_fallback.c \
iterator_fallback.h iterator_grib.c iterator_grib.h cfortran.h \
cdiFortran.c gribapi_utilities.c stream_gribapi.c
am__objects_1 = cdiFortran.lo
@USE_FC_TRUE@am__objects_2 = $(am__objects_1)
am__objects_3 = gribapi_utilities.lo stream_gribapi.lo
......@@ -202,14 +201,13 @@ am_libcdi_la_OBJECTS = basetime.lo binary.lo calendar.lo cdf.lo \
institution.lo model.lo namespace.lo serialize.lo \
referenceCounting.lo resource_handle.lo servicelib.lo \
stream_cdf.lo stream_cgribex.lo stream_ext.lo stream_grb.lo \
stream_history.lo stream_ieg.lo stream_fcommon.lo cdi_int.lo \
stream_record.lo stream_srv.lo stream_var.lo grb_write.lo \
grb_read.lo cdf_write.lo cdf_read.lo subtype.lo table.lo \
taxis.lo timebase.lo tsteps.lo util.lo varscan.lo version.lo \
vlist.lo vlist_att.lo vlist_var.lo zaxis.lo stream.lo \
stream_write.lo stream_read.lo swap.lo iterator.lo \
iterator_fallback.lo iterator_grib.lo $(am__objects_2) \
$(am__objects_4)
stream_history.lo stream_ieg.lo cdi_int.lo stream_record.lo \
stream_srv.lo stream_var.lo grb_write.lo grb_read.lo \
cdf_write.lo cdf_read.lo subtype.lo table.lo taxis.lo \
timebase.lo tsteps.lo util.lo varscan.lo version.lo vlist.lo \
vlist_att.lo vlist_var.lo zaxis.lo stream.lo stream_write.lo \
stream_read.lo swap.lo iterator.lo iterator_fallback.lo \
iterator_grib.lo $(am__objects_2) $(am__objects_4)
libcdi_la_OBJECTS = $(am_libcdi_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
......@@ -519,17 +517,16 @@ libcdi_la_SOURCES = basetime.c basetime.h binary.c binary.h calendar.c \
resource_handle.h service.h servicelib.c stream_cdf.c \
stream_cdf.h stream_cgribex.c stream_cgribex.h stream_ext.c \
stream_ext.h stream_grb.c stream_grb.h stream_gribapi.h \
stream_history.c stream_ieg.c stream_ieg.h stream_fcommon.c \
stream_fcommon.h cdi_int.c cdi_int.h stream_record.c \
stream_srv.c stream_srv.h stream_var.c grb_write.c grb_read.c \
cdf_write.c cdf_read.c subtype.c subtype.h swap.h table.c \
table.h tablepar.h taxis.c taxis.h timebase.c timebase.h \
tsteps.c util.c varscan.c varscan.h version.c vlist.c vlist.h \
vlist_att.c vlist_att.h vlist_var.c vlist_var.h zaxis.c \
zaxis.h stream.c stream_write.c stream_read.c swap.c \
iterator.c iterator.h iterator_fallback.c iterator_fallback.h \
iterator_grib.c iterator_grib.h $(am__append_2) \
$(am__append_3)
stream_history.c stream_ieg.c stream_ieg.h cdi_int.c cdi_int.h \
stream_record.c stream_srv.c stream_srv.h stream_var.c \
grb_write.c grb_read.c cdf_write.c cdf_read.c subtype.c \
subtype.h swap.h table.c table.h tablepar.h taxis.c taxis.h \
timebase.c timebase.h tsteps.c util.c varscan.c varscan.h \
version.c vlist.c vlist.h vlist_att.c vlist_att.h vlist_var.c \
vlist_var.h zaxis.c zaxis.h stream.c stream_write.c \
stream_read.c swap.c iterator.c iterator.h iterator_fallback.c \
iterator_fallback.h iterator_grib.c iterator_grib.h \
$(am__append_2) $(am__append_3)
# cfortran.h is an optional part of libcdi
libcdi_la_USE_FC_extra_sources = \
......@@ -746,7 +743,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_cdf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_cgribex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_ext.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_fcommon.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_grb.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_gribapi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_history.Plo@am__quote@
......@@ -938,8 +934,8 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
@ENABLE_CDI_LIB_FALSE@install-exec-local:
@ENABLE_CDI_LIB_FALSE@uninstall-local:
@ENABLE_CDI_LIB_FALSE@install-exec-local:
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
......
......@@ -366,6 +366,8 @@ void vlist_check_contents(int vlistID);
void cdi_create_records(stream_t *streamptr, int tsID);
void streamFCopyRecord(stream_t *streamptr2, stream_t *streamptr1, const char *container_name);
int recordNewEntry(stream_t *streamptr, int tsID);
void cdiCreateTimesteps(stream_t *streamptr);
......
#include <stdlib.h>
#include "cdi_int.h"
#include "dmemory.h"
#include "file.h"
#include "stream_fcommon.h"
void streamFCopyRecord(stream_t *streamptr2, stream_t *streamptr1, const char *container_name)
{
int fileID1 = streamptr1->fileID;
int fileID2 = streamptr2->fileID;
int tsID = streamptr1->curTsID;
int vrecID = streamptr1->tsteps[tsID].curRecID;
int recID = streamptr1->tsteps[tsID].recIDs[vrecID];
off_t recpos = streamptr1->tsteps[tsID].records[recID].position;
size_t recsize = streamptr1->tsteps[tsID].records[recID].size;
if (fileSetPos(fileID1, recpos, SEEK_SET) != 0)
Error("Cannot seek input file for %s record copy!", container_name);
char *buffer = (char *) Malloc(recsize);
if (fileRead(fileID1, buffer, recsize) != recsize)
Error("Failed to read record from %s file for copying!", container_name);
if (fileWrite(fileID2, buffer, recsize) != recsize)
Error("Failed to write record to %s file when copying!", container_name);
Free(buffer);
}
/*
* Local Variables:
* c-file-style: "Java"
* c-basic-offset: 2
* indent-tabs-mode: nil
* show-trailing-whitespace: t
* require-trailing-newline: t
* End:
*/
#ifndef STREAM_FCOMMON_H
#define STREAM_FCOMMON_H
#ifndef _CDI_INT_H
#include "cdi_int.h"
#endif
void streamFCopyRecord(stream_t *streamptr2, stream_t *streamptr1,
const char *container_name);
#endif
/*
* Local Variables:
* c-file-style: "Java"
* c-basic-offset: 2
* indent-tabs-mode: nil
* show-trailing-whitespace: t
* require-trailing-newline: t
* End:
*/
......@@ -373,6 +373,32 @@ void cdi_create_records(stream_t *streamptr, int tsID)
}
}
}
void streamFCopyRecord(stream_t *streamptr2, stream_t *streamptr1, const char *container_name)
{
int fileID1 = streamptr1->fileID;
int fileID2 = streamptr2->fileID;
int tsID = streamptr1->curTsID;
int vrecID = streamptr1->tsteps[tsID].curRecID;
int recID = streamptr1->tsteps[tsID].recIDs[vrecID];
off_t recpos = streamptr1->tsteps[tsID].records[recID].position;
size_t recsize = streamptr1->tsteps[tsID].records[recID].size;
if (fileSetPos(fileID1, recpos, SEEK_SET) != 0)
Error("Cannot seek input file for %s record copy!", container_name);
char *buffer = (char *) Malloc(recsize);
if (fileRead(fileID1, buffer, recsize) != recsize)
Error("Failed to read record from %s file for copying!", container_name);
if (fileWrite(fileID2, buffer, recsize) != recsize)
Error("Failed to write record to %s file when copying!", container_name);
Free(buffer);
}
/*
* Local Variables:
* c-file-style: "Java"
......
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