Open SFF file and return source line and FREE block.
c----------------------------------------------------------------------
subroutine sff_ROpenFS(lu, filename,
& version, timestamp, code,
& nline, lines, lenmax, lindim,
& type, cs, c1, c2, c3, date, time, ierr)
c
c Open file for reading. Read STAT line, FREE block and SRCE line.
c
c input:
c filename name of file
c lindim number of elements in FREE block array lines
c ouput:
c version version of writing library
c timestamp time and date file was written
c code indicates optional blocks
c ierr error status (ok: ierr=0)
c nline number of FREE lines read
c lines FREE lines
c lenmax length of longest FREE line in array lines
c type type of source
c cs coordinate system
c c1, c2, c3 coordinates of source
c date, time date and time of source signal
c
integer lu, ierr, nline, lindim, lenmax
character timestamp*(*), code *(*), lines(lindim)*(*)
character filename*(*), type*(*), date*(*), time*(*), cs*1
c----------------------------------------------------------------------
97 datrw::ianystream &is=
101 std::string ocode(
"");
102 if (is.hasfree()) { ocode.append(
"F"); }
103 if (is.hassrce()) { ocode.append(
"S"); }
104 if (is.hassrce()) { is >> srce; }
106 std::string srceline=srce.line();
109 char thecs=sff::coosysID(srce.cs);
111 *c1=
static_cast<real>(srce.cx);
112 *c2=
static_cast<real>(srce.cy);
113 *c3=
static_cast<real>(srce.cz);
114 fillfstring(srceline.substr(74,6), date, date_len);
115 fillfstring(srceline.substr(81,10), time, time_len);
118 if (is.hasfree()) { is >> free; }
119 freeblock(free, nline, lines, lindim, lenmax, lines_len);
122 fillfstring(stat.timestamp, timestamp, timestamp_len);
123 *version=
static_cast<real>(sff::STAT::libversion);
sff::FREE freeblock(integer *nline, char *lines, ftnlen lines_len)
create C++ FREE block from Fortran FREE lines
void fillfstring(const std::string &s, char *fstring, ftnlen slen)
fill a Fortran string with a C++ string
float real
Fortran real type (single precision)
datrw::ianystream & open(const int &unit, const std::string &filename)
open a new file
std::string stringfromfstring(char *fstring, ftnlen slen)
create a C++ string from a Fortran string
::fapidxx::IFileUnits istreammanager
the global istream manager