Commit fb11f818 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

croposp [WP]: outline file reading

parent ffa609a3
......@@ -48,13 +48,14 @@
# 01/02/2014 thof: rewrite all linker rules with libraries in
# proper order
# 19/03/2016 thof: tidofi requires libgsl for filter GaussianNoise
# 25/12/2018 thof: add new program croposp
#
# ============================================================================
PROGRAMS=tsfilt stufi rotate coro xyz2uvw susei suseix evelo \
smoos dise foutra teseco resaseda gatherdiff \
autocorr cross tidofi sigfit noisymize sigval fidasexx soutifu \
deconv geophone sigscale tisli suspect evelox
deconv geophone sigscale tisli suspect evelox croposp
.PHONY: all
all: install doc
......@@ -235,7 +236,7 @@ noisymize: \
$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@ \
$(LIBTSIOXX)
cross fregra foutra deconv: \
croposp cross fregra foutra deconv: \
%: %.o
$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@ \
-lfourierxx $(LIBTSIOXX) -lfftw3
......
......@@ -26,6 +26,11 @@ using std::cout;
using std::cerr;
using std::endl;
struct Options {
bool verbose;
std::string inputformat;
}; // struct Options
int main(int iargc, char* argv[])
{
......@@ -40,7 +45,11 @@ int main(int iargc, char* argv[])
// define full help text
char help_text[]=
{
" "
"-verbose verbose\n"
"-itype f input file format\n"
"\n"
"t:sel trace selection\n"
"f:format file format\n"
};
// define commandline options
......@@ -50,15 +59,18 @@ int main(int iargc, char* argv[])
// 0: print help
{"help",arg_no,"-"},
// 1: verbose mode
{"v",arg_no,"-"},
{"verbose",arg_no,"-"},
// 2: default input file format
{"itype",arg_yes,"sff"},
{NULL}
};
// define command line keys for input files
static const char tracekey[]="t";
static const char formatkey[]="f";
// define commandline argument modifier keys
static const char* cmdlinekeys[]={tracekey, 0};
static const char* cmdlinekeys[]={tracekey, formatkey, 0};
// no arguments? print usage...
if (iargc<2)
......@@ -77,11 +89,29 @@ int main(int iargc, char* argv[])
cerr << help_text << endl;
exit(0);
}
Options opt;
opt.verbose=cmdline.optset(1);
opt.inputformat=cmdline.string_arg(2);
// extract commandline arguments
TFXX_assert(cmdline.extra(), "missing input file");
tfxx::cmdline::Tparsed arguments=parse_cmdline(cmdline, cmdlinekeys);
ts::sff::TDFileList input_file_list;
tfxx::cmdline::Tparsed::const_iterator file=arguments.begin();
while (file != arguments.end())
{
std::string format=opt.inputformat;
if (file->haskey(formatkey))
{
format=file->value(formatkey);
}
input_file_list.push_back(ts::sff::readDSFF(*file, opt.verbose,
tracekey, format));
++file;
}
} // main()
/* ----- END OF croposp.cc ----- */
Markdown is supported
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