Fortran SFF API to data I/O streams in C++
fapidsff.h
Go to the documentation of this file.
1 
40 // include guard
41 #ifndef TF_FAPIDSFF_H_VERSION
42 
43 #define TF_FAPIDSFF_H_VERSION \
44  "TF_FAPIDSFF_H V1.3"
45 
46 /*----------------------------------------------------------------------*/
47 // provide Fortran types
48 
49 // this is the interface declaration
50 // the function should be callable from Fortran
51 extern "C" {
52 
53 #ifndef F2C_INCLUDE
54 /* FORTRAN (f2c) types needed by the wrapper functions */
55 
56 /* gfortran and g77 on 64bit system apparently do not use long int */
57 #ifdef __x86_64
58 typedef int integer;
61 typedef int logical;
63 typedef int ftnlen;
64 #else
65 typedef long int integer;
68 typedef long int logical;
70 typedef long int ftnlen;
71 #endif
72 typedef float real;
75 typedef double doublereal;
76 #else
77 #warning "f2c.h is read from somewhere else!"
78 #ifdef __x86_64
79 #error "long int integer type in f2c.h does not work for x86_64 compilation!"
80 #endif
81 // this header is only for internal use within libfapidxx
82 #error "this header file must only be used internally!"
83 #endif
84 
85 /*----------------------------------------------------------------------*/
86 
87 extern doublereal sff_libversion__(void);
88 
89 extern int sff_f2i__(integer *idata, real *fdata, integer *nsamples, real *ampfac);
90 
91 extern int sff_i2f__(integer *idata, real *fdata, integer *nsamples, real *ampfac);
92 
93 extern int sff_new__(integer *lu, char *filename, integer *ierr, ftnlen filename_len);
94 
95 extern int sff_wopen__(integer *lu, char *filename, integer *ierr, ftnlen filename_len);
96 
97 extern int sff_wopenf__(integer *lu, char *filename, char *lines, integer *nline, integer *ierr, ftnlen filename_len, ftnlen lines_len);
98 
99 extern int sff_wopens__(integer *lu, char *filename, char *type__, char *cs, real *c1, real *c2, real *c3, char *date, char *time, integer *ierr, ftnlen filename_len, ftnlen type_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len);
100 
101 extern int sff_wopenfs__(integer *lu, char *filename, char *lines, integer *nline, char *type__, char *cs, real *c1, real *c2, real *c3, char *date, char *time, integer *ierr, ftnlen filename_len, ftnlen lines_len, ftnlen type_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len);
102 
103 extern int sff_ropen__(integer *lu, char *filename, real *version, char *timestamp, char *code, integer *ierr, ftnlen filename_len, ftnlen timestamp_len, ftnlen code_len);
104 
105 extern int sff_ropenf__(integer *lu, char *filename, real *version, char *timestamp, char *code, integer *nline, char *lines, integer *lenmax, integer *lindim, integer *ierr, ftnlen filename_len, ftnlen timestamp_len, ftnlen code_len, ftnlen lines_len);
106 
107 extern int sff_ropens__(integer *lu, char *filename, real *version, char *timestamp, char *code, char *type__, char *cs, real *c1, real *c2, real *c3, char *date, char *time, integer *ierr, ftnlen filename_len, ftnlen timestamp_len, ftnlen code_len, ftnlen type_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len);
108 
109 extern int sff_ropenfs__(integer *lu, char *filename, real *version, char *timestamp, char *code, integer *nline, char *lines, integer *lenmax, integer *lindim, char *type__, char *cs, real *c1, real *c2, real *c3, char *date, char *time, integer *ierr, ftnlen filename_len, ftnlen timestamp_len, ftnlen code_len, ftnlen lines_len, ftnlen type_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len);
110 
111 extern int sff_wtrace__(integer *lu, char *wid2line, integer *nsamp, real *fdata, integer *idata, logical *last, integer *ierr, ftnlen wid2line_len);
112 
113 extern int sff_wtracef__(integer *lu, char *wid2line, integer *nsamp, real *fdata, integer *idata, logical *last, integer *nline, char *lines, integer *ierr, ftnlen wid2line_len, ftnlen lines_len);
114 
115 extern int sff_wtracei__(integer *lu, char *wid2line, integer *nsamp, real *fdata, integer *idata, logical *last, char *cs, real *c1, real *c2, real *c3, integer *nstack, integer *ierr, ftnlen wid2line_len, ftnlen cs_len);
116 
117 extern int sff_wtracefi__(integer *lu, char *wid2line, integer *nsamp, real *fdata, integer *idata, logical *last, integer *nline, char *lines, char *cs, real *c1, real *c2, real *c3, integer *nstack, integer *ierr, ftnlen wid2line_len, ftnlen lines_len, ftnlen cs_len);
118 
119 extern int sff_rtrace__(integer *lu, real *tanf, real *dt, char *wid2line, integer *nsamp, real *fdata, integer *idata, char *code, logical *last, integer *ierr, ftnlen wid2line_len, ftnlen code_len);
120 
121 extern int sff_rtracef__(integer *lu, real *tanf, real *dt, char *wid2line, integer *nsamp, real *fdata, integer *idata, char *code, logical *last, integer *nline, char *lines, integer *lindim, integer *lenmax, integer *ierr, ftnlen wid2line_len, ftnlen code_len, ftnlen lines_len);
122 
123 extern int sff_rtracei__(integer *lu, real *tanf, real *dt, char *wid2line, integer *nsamp, real *fdata, integer *idata, char *code, logical *last, char *cs, real *c1, real *c2, real *c3, integer *nstack, integer *ierr, ftnlen wid2line_len, ftnlen code_len, ftnlen cs_len);
124 
125 extern int sff_rtracefi__(integer *lu, real *tanf, real *dt, char *wid2line, integer *nsamp, real *fdata, integer *idata, char *code, logical *last, integer *nline, char *lines, integer *lindim, integer *lenmax, char *cs, real *c1, real *c2, real *c3, integer *nstack, integer *ierr, ftnlen wid2line_len, ftnlen code_len, ftnlen lines_len, ftnlen cs_len);
126 
127 extern int sff_modwid2samprat__(char *wid2line, real *samprat, ftnlen wid2line_len);
128 
129 extern int sff_modwid2samps__(char *wid2line, integer *samps, ftnlen wid2line_len);
130 
131 extern int sff_modwid2date__(char *wid2line, integer *year, integer *month, integer *day, ftnlen wid2line_len);
132 
133 extern int sff_modwid2time__(char *wid2line, integer *hour, integer *minute, real *second, ftnlen wid2line_len);
134 
135 extern int sff_modwid2shift__(char *wid2line, real *tmin, real *tsec, ftnlen wid2line_len);
136 
137 extern logical sff_timeisleapyear__(integer *year);
138 
139 extern int sff_timesetdoy__(integer *doy, integer *year, integer *month, integer *day);
140 
141 extern integer sff_timegetdoy__(integer *year, integer *month, integer *day);
142 
143 extern int sff_timesplit__(real *tsec, integer *day, integer *hour, integer *minute, real *second);
144 
145 extern int sff_timeadd__(integer *year1, integer *doy1, integer *hour1, integer *minute1, real *second1, integer *year2, integer *doy2, integer *hour2, integer *minute2, real *second2, integer *year, integer *doy, integer *hour, integer *minute, real *second);
146 
147 extern int sff_quickwrite__(integer *lu, char *wid2line, integer *nsamp, integer *idata, real *ampfac, ftnlen wid2line_len);
148 
149 extern int sff_quickread__(integer *lu, char *wid2line, integer *nsamp, real *tanf, real *dt, integer *idata, real *ampfac, integer *ierr, ftnlen wid2line_len);
150 
151 extern int sff_wstatus__(integer *lu, char *code, ftnlen code_len);
152 
153 extern int sff_rstatus__(integer *lu, real *version, char *timestamp, char *code, integer *ierr, ftnlen timestamp_len, ftnlen code_len);
154 
155 extern int sff_wfree__(integer *lu, integer *nline, char *lines, ftnlen lines_len);
156 
157 extern int sff_rfree__(integer *lu, integer *nline, char *lines, integer *lenmax, integer *lindim, integer *ierr, ftnlen lines_len);
158 
159 extern int sff_skipfree__(integer *lu, integer *ierr);
160 
161 extern int sff_wsource__(integer *lu, char *typh, char *cs, real *c1, real *c2, real *c3, char *date, char *time, ftnlen typh_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len);
162 
163 extern int sff_rsource__(integer *lu, char *typ, char *cs, real *c1, real *c2, real *c3, char *date, char *time, integer *ierr, ftnlen typ_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len);
164 
165 extern int sff_winfo__(integer *lu, char *cs, real *c1, real *c2, real *c3, integer *nstack, ftnlen cs_len);
166 
167 extern int sff_rinfo__(integer *lu, char *cs, real *c1, real *c2, real *c3, integer *nstack, integer *ierr, ftnlen cs_len);
168 
169 extern int sff_checksum__(integer *nsamp, integer *idata, integer *nchecksum);
170 
171 extern int sff_rwdata__(integer *lu, char *wid2line, char *code, real *ampfac, integer *nsamp, integer *idata, logical *rwflag, integer *ierr, ftnlen wid2line_len, ftnlen code_len);
172 
173 extern int sff_wdata__(integer *lu, char *wid2line, integer *nsamp, integer *idata, real *ampfac, char *code, ftnlen wid2line_len, ftnlen code_len);
174 
175 extern int sff_rwid2__(integer *lu, char *wid2line, integer *nsamp, real *tanf, real *dt, integer *nchar, real *ampfac, char *code, integer *ierr, ftnlen wid2line_len, ftnlen code_len);
176 
177 extern int sff_rdata__(integer *lu, char *wid2line, integer *nsamp, real *tanf, real *dt, integer *idata, real *ampfac, char *code, integer *ierr, ftnlen wid2line_len, ftnlen code_len);
178 
179 extern int sff_rdata2__(integer *lu, integer *nsamp, integer *idata, char *cbuf, integer *nchar, integer *ierr, ftnlen cbuf_len);
180 
181 extern int sff_skipdata__(integer *lu, char *code, logical *last, integer *ierr, ftnlen code_len);
182 
183 extern int sff_prepwid2__(integer *nsamp, real *samprat, char *station, integer *year, integer *month, integer *day, integer *hour, integer *minute, char *comp, char *auxid, char *instyp, real *second, real *calib, real *calper, real *hang, real *vang, char *wid2line, integer *ierr, ftnlen station_len, ftnlen comp_len, ftnlen auxid_len, ftnlen instyp_len, ftnlen wid2line_len);
184 
185 extern int sff_getdate__(char *wid2line, char *date, ftnlen wid2line_len, ftnlen date_len);
186 
187 extern int sff_gettime__(char *wid2line, char *time, ftnlen wid2line_len, ftnlen time_len);
188 
189 extern int sff_getstation__(char *wid2line, char *sta, ftnlen wid2line_len, ftnlen sta_len);
190 
191 extern int sff_getchannel__(char *wid2line, char *channel, ftnlen wid2line_len, ftnlen channel_len);
192 
193 extern integer sff_getn__(char *wid2line, ftnlen wid2line_len);
194 
195 extern doublereal sff_getdt__(char *wid2line, ftnlen wid2line_len);
196 
197 extern int sff_trimlen__(char *string, integer *ntrim, ftnlen string_len);
198 
199 extern int sff_close__(integer *lu, integer *ierr);
200 
201 extern int sff_select_format__(char *formatid, integer *ierr, ftnlen
202  formatid_len);
203 
204 extern int sff_select_input_format__(char *formatid, integer *ierr, ftnlen
205  formatid_len);
206 
207 extern int sff_select_output_format__(char *formatid, integer *ierr, ftnlen
208  formatid_len);
209 
210 extern int sff_help_formats__(void);
211 
212 extern int sff_help_details__(void);
213 
214 } // extern "C"
215 
216 /*:ref: idate_ 14 1 4 */
217 /*:ref: itime_ 14 1 4 */
218 /*:ref: dcomp6_ 14 6 4 13 4 4 4 124 */
219 /*:ref: remdif1_ 14 2 4 4 */
220 /*:ref: dif1_ 14 2 4 4 */
221 /*:ref: cmprs6_ 14 6 4 4 4 13 4 124 */
222 
223 #endif // TF_FAPIDSFF_H_VERSION (includeguard)
224 
225 /* ----- END OF fapidsff.h ----- */
int sff_wopenfs__(integer *lu, char *filename, char *lines, integer *nline, char *type__, char *cs, real *c1, real *c2, real *c3, char *date, char *time, integer *ierr, ftnlen filename_len, ftnlen lines_len, ftnlen type_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len)
Open file for writing and pass FREE block and SRCE line.
int sff_quickwrite__(integer *lu, char *wid2line, integer *nsamp, integer *idata, real *ampfac, ftnlen wid2line_len)
int sff_wopen__(integer *lu, char *filename, integer *ierr, ftnlen filename_len)
Open file for writing.
int sff_skipdata__(integer *lu, char *code, logical *last, integer *ierr, ftnlen code_len)
Skip a complete trace.
int sff_modwid2samprat__(char *wid2line, real *samprat, ftnlen wid2line_len)
modify sampling rate in WID2 line
int sff_rdata2__(integer *lu, integer *nsamp, integer *idata, char *cbuf, integer *nchar, integer *ierr, ftnlen cbuf_len)
int sff_help_details__(void)
print detailed information about modules in libdatrwxx
int sff_getchannel__(char *wid2line, char *channel, ftnlen wid2line_len, ftnlen channel_len)
int sff_modwid2time__(char *wid2line, integer *hour, integer *minute, real *second, ftnlen wid2line_len)
modify time of first sample in WID2 line
int sff_wopenf__(integer *lu, char *filename, char *lines, integer *nline, integer *ierr, ftnlen filename_len, ftnlen lines_len)
int sff_wtracef__(integer *lu, char *wid2line, integer *nsamp, real *fdata, integer *idata, logical *last, integer *nline, char *lines, integer *ierr, ftnlen wid2line_len, ftnlen lines_len)
int sff_getdate__(char *wid2line, char *date, ftnlen wid2line_len, ftnlen date_len)
int sff_rwid2__(integer *lu, char *wid2line, integer *nsamp, real *tanf, real *dt, integer *nchar, real *ampfac, char *code, integer *ierr, ftnlen wid2line_len, ftnlen code_len)
doublereal sff_getdt__(char *wid2line, ftnlen wid2line_len)
long int integer
Fortran integer type.
Definition: fapidsff.h:66
int sff_quickread__(integer *lu, char *wid2line, integer *nsamp, real *tanf, real *dt, integer *idata, real *ampfac, integer *ierr, ftnlen wid2line_len)
int sff_select_output_format__(char *formatid, integer *ierr, ftnlen formatid_len)
select format for output
int sff_rtrace__(integer *lu, real *tanf, real *dt, char *wid2line, integer *nsamp, real *fdata, integer *idata, char *code, logical *last, integer *ierr, ftnlen wid2line_len, ftnlen code_len)
Read one trace of data.
int sff_wopens__(integer *lu, char *filename, char *type__, char *cs, real *c1, real *c2, real *c3, char *date, char *time, integer *ierr, ftnlen filename_len, ftnlen type_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len)
Open file for writing and pass SRCE line.
int sff_wfree__(integer *lu, integer *nline, char *lines, ftnlen lines_len)
int sff_rtracefi__(integer *lu, real *tanf, real *dt, char *wid2line, integer *nsamp, real *fdata, integer *idata, char *code, logical *last, integer *nline, char *lines, integer *lindim, integer *lenmax, char *cs, real *c1, real *c2, real *c3, integer *nstack, integer *ierr, ftnlen wid2line_len, ftnlen code_len, ftnlen lines_len, ftnlen cs_len)
Read one trace of data and return FREE block and INFO line additionally.
int sff_help_formats__(void)
list supported data formats
int sff_checksum__(integer *nsamp, integer *idata, integer *nchecksum)
int sff_wsource__(integer *lu, char *typh, char *cs, real *c1, real *c2, real *c3, char *date, char *time, ftnlen typh_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len)
int sff_timesetdoy__(integer *doy, integer *year, integer *month, integer *day)
doublereal sff_libversion__(void)
int sff_ropens__(integer *lu, char *filename, real *version, char *timestamp, char *code, char *type__, char *cs, real *c1, real *c2, real *c3, char *date, char *time, integer *ierr, ftnlen filename_len, ftnlen timestamp_len, ftnlen code_len, ftnlen type_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len)
Open SFF file and return source line.
double doublereal
Fortran double real type.
Definition: fapidsff.h:75
int sff_gettime__(char *wid2line, char *time, ftnlen wid2line_len, ftnlen time_len)
int sff_rinfo__(integer *lu, char *cs, real *c1, real *c2, real *c3, integer *nstack, integer *ierr, ftnlen cs_len)
integer sff_getn__(char *wid2line, ftnlen wid2line_len)
int sff_rwdata__(integer *lu, char *wid2line, char *code, real *ampfac, integer *nsamp, integer *idata, logical *rwflag, integer *ierr, ftnlen wid2line_len, ftnlen code_len)
int sff_select_format__(char *formatid, integer *ierr, ftnlen formatid_len)
select format for input and output
int sff_rtracei__(integer *lu, real *tanf, real *dt, char *wid2line, integer *nsamp, real *fdata, integer *idata, char *code, logical *last, char *cs, real *c1, real *c2, real *c3, integer *nstack, integer *ierr, ftnlen wid2line_len, ftnlen code_len, ftnlen cs_len)
Read one trace of data and return INFO line additionally.
float real
Fortran real type (single precision)
Definition: fapidsff.h:73
int sff_ropen__(integer *lu, char *filename, real *version, char *timestamp, char *code, integer *ierr, ftnlen filename_len, ftnlen timestamp_len, ftnlen code_len)
Open SFF file.
int sff_wtrace__(integer *lu, char *wid2line, integer *nsamp, real *fdata, integer *idata, logical *last, integer *ierr, ftnlen wid2line_len)
Write one trace of data with INFO line.
int sff_select_input_format__(char *formatid, integer *ierr, ftnlen formatid_len)
select format for input
int sff_wdata__(integer *lu, char *wid2line, integer *nsamp, integer *idata, real *ampfac, char *code, ftnlen wid2line_len, ftnlen code_len)
int sff_timesplit__(real *tsec, integer *day, integer *hour, integer *minute, real *second)
long int logical
Fortran logical type.
Definition: fapidsff.h:68
int sff_modwid2date__(char *wid2line, integer *year, integer *month, integer *day, ftnlen wid2line_len)
modify date of first sample in WID2 line
int sff_new__(integer *lu, char *filename, integer *ierr, ftnlen filename_len)
Delete existing file.
int sff_modwid2samps__(char *wid2line, integer *samps, ftnlen wid2line_len)
modify number of samples in WID2 line
int sff_skipfree__(integer *lu, integer *ierr)
int sff_ropenfs__(integer *lu, char *filename, real *version, char *timestamp, char *code, integer *nline, char *lines, integer *lenmax, integer *lindim, char *type__, char *cs, real *c1, real *c2, real *c3, char *date, char *time, integer *ierr, ftnlen filename_len, ftnlen timestamp_len, ftnlen code_len, ftnlen lines_len, ftnlen type_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len)
Open SFF file and return source line and FREE block.
int sff_prepwid2__(integer *nsamp, real *samprat, char *station, integer *year, integer *month, integer *day, integer *hour, integer *minute, char *comp, char *auxid, char *instyp, real *second, real *calib, real *calper, real *hang, real *vang, char *wid2line, integer *ierr, ftnlen station_len, ftnlen comp_len, ftnlen auxid_len, ftnlen instyp_len, ftnlen wid2line_len)
Encode WID2 data.
integer sff_timegetdoy__(integer *year, integer *month, integer *day)
int sff_ropenf__(integer *lu, char *filename, real *version, char *timestamp, char *code, integer *nline, char *lines, integer *lenmax, integer *lindim, integer *ierr, ftnlen filename_len, ftnlen timestamp_len, ftnlen code_len, ftnlen lines_len)
int sff_rfree__(integer *lu, integer *nline, char *lines, integer *lenmax, integer *lindim, integer *ierr, ftnlen lines_len)
int sff_getstation__(char *wid2line, char *sta, ftnlen wid2line_len, ftnlen sta_len)
int sff_timeadd__(integer *year1, integer *doy1, integer *hour1, integer *minute1, real *second1, integer *year2, integer *doy2, integer *hour2, integer *minute2, real *second2, integer *year, integer *doy, integer *hour, integer *minute, real *second)
int sff_trimlen__(char *string, integer *ntrim, ftnlen string_len)
long int ftnlen
Fortran string size type.
Definition: fapidsff.h:70
int sff_close__(integer *lu, integer *ierr)
Close SFF file.
int sff_wstatus__(integer *lu, char *code, ftnlen code_len)
int sff_rstatus__(integer *lu, real *version, char *timestamp, char *code, integer *ierr, ftnlen timestamp_len, ftnlen code_len)
int sff_rdata__(integer *lu, char *wid2line, integer *nsamp, real *tanf, real *dt, integer *idata, real *ampfac, char *code, integer *ierr, ftnlen wid2line_len, ftnlen code_len)
int sff_winfo__(integer *lu, char *cs, real *c1, real *c2, real *c3, integer *nstack, ftnlen cs_len)
int sff_rsource__(integer *lu, char *typ, char *cs, real *c1, real *c2, real *c3, char *date, char *time, integer *ierr, ftnlen typ_len, ftnlen cs_len, ftnlen date_len, ftnlen time_len)
int sff_modwid2shift__(char *wid2line, real *tmin, real *tsec, ftnlen wid2line_len)
shift time of first sample in WID2 line
int sff_i2f__(integer *idata, real *fdata, integer *nsamples, real *ampfac)
int sff_rtracef__(integer *lu, real *tanf, real *dt, char *wid2line, integer *nsamp, real *fdata, integer *idata, char *code, logical *last, integer *nline, char *lines, integer *lindim, integer *lenmax, integer *ierr, ftnlen wid2line_len, ftnlen code_len, ftnlen lines_len)
int sff_wtracei__(integer *lu, char *wid2line, integer *nsamp, real *fdata, integer *idata, logical *last, char *cs, real *c1, real *c2, real *c3, integer *nstack, integer *ierr, ftnlen wid2line_len, ftnlen cs_len)
Write one trace of data with INFO line.
int sff_f2i__(integer *idata, real *fdata, integer *nsamples, real *ampfac)
logical sff_timeisleapyear__(integer *year)
int sff_wtracefi__(integer *lu, char *wid2line, integer *nsamp, real *fdata, integer *idata, logical *last, integer *nline, char *lines, char *cs, real *c1, real *c2, real *c3, integer *nstack, integer *ierr, ftnlen wid2line_len, ftnlen lines_len, ftnlen cs_len)
Write one trace of data with FREE block and INFO line.