76 "usage: any2sff [-v] [-o] [-Fbonjer] [-Fsff] [-Fpdas] [-Fhpmo]" "\n" 77 " [-t type] [-GSE]" "\n" 78 " file [ file [ ... ]] sff-file" "\n" 79 " or: any2sff --help|-h" "\n" 85 "file input file of selected format" "\n" 86 "sff-file output file in SFF" "\n" 89 "-o overwrite output file" "\n" 90 "-t type select input data format" "\n" 91 "-Fsff input format is SFF" "\n" 92 "-Fhpmo input format is multiplexed ASCII format" "\n" 93 " defined by WG for BFO HP-MO data acquisition system" "\n" 94 "-Fpdas input format is PDAS100 (i.e. DaDisp)" "\n" 95 "-Fbonjer input format is defined by K. Bonjer for" "\n" 97 "-GSE use GSE compatible scaling, when writing data" "\n" 98 " notice: the dynamic range will be reduced to integer values" "\n" 102 using namespace tfxx::cmdline;
103 static Declare options[]=
112 {
"Fhpmo",arg_no,
"-"},
114 {
"Fpdas",arg_no,
"-"},
116 {
"Fbonjer",arg_no,
"-"},
131 "******************************************************************\n" 132 "THIS PROGRAM IS OBSOLETE\n" 133 "any2sff is no longer maintained and may vanish in the future\n" 134 "consider to use any2any instead\n" 135 "******************************************************************\n";
142 cerr << usage_text << endl;
143 cerr << tfxx::seitosh::repository_reference << endl;
148 Commandline cmdline(iargc, argv, options);
151 if (cmdline.optset(0))
153 cerr << usage_text << endl;
154 cerr << help_text << endl;
155 datrw::supported_data_types(cerr);
156 datrw::online_help(cerr);
157 cerr << endl << tfxx::seitosh::repository_reference << endl;
162 opt.
format=datrw::anyID(datrw::Fsff);
163 if (cmdline.optset(3)) { opt.
format=datrw::anyID(datrw::Fhpmo); }
164 if (cmdline.optset(4)) { opt.
format=datrw::anyID(datrw::Fpdas); }
165 if (cmdline.optset(5)) { opt.
format=datrw::anyID(datrw::Fbonjer); }
166 opt.
debug=cmdline.optset(6);
168 if (cmdline.optset(8)) { opt.
format=cmdline.string_arg(8); }
175 filefree.append(
"input files:");
178 TFXX_assert(cmdline.extra(),
"ERROR: missing input file!");
179 outfile=cmdline.next();
181 while (cmdline.extra())
183 infiles.push_back(outfile);
184 filefree.append(outfile);
185 outfile=cmdline.next();
187 TFXX_assert((infiles.size()>0),
"ERROR: missing output file!");
189 filefree.append(
"output file:");
190 filefree.append(outfile);
191 filefree.append(
"any SRCE line or file FREE block in input data is ignored!");
193 if (opt.
verbose) { filefree.write(cout); }
198 std::ifstream file(outfile.c_str(),std::ios_base::in);
199 TFXX_assert((!file.good()),
"ERROR: output file exists!");
201 std::ofstream ofs(outfile.c_str());
202 sff::SFFostream<Tseries> os(ofs, opt.
debug);
206 { cout <<
"select GSE compatible scaling" << endl; }
207 os.setnormmode(sff::NM_one);
211 Tvecofstrings::const_iterator infile=infiles.begin();
212 while( infile!=infiles.end())
215 { cout <<
"** open next file: " << *infile << endl; }
216 std::ifstream ifs(infile->c_str(), datrw::ianystream::openmode(opt.
format));
222 { cout <<
"**** convert next trace" << endl; }
223 datrw::Tdseries series;
224 if (opt.
debug) { cerr <<
"DEBUG: read series" << endl; }
226 if (opt.
debug) { cerr <<
"DEBUG: write series" << endl; }
229 if (opt.
debug) { cerr <<
"DEBUG: read WID2" << endl; }
231 if (opt.
debug) { cerr <<
"DEBUG: write WID2" << endl; }
233 if (opt.
debug) { cerr <<
"DEBUG: read and write INFO" 234 <<
" if available" << endl; }
235 if (is.hasinfo()) { sff::INFO info; is >> info; os << info; }
236 if (opt.
debug) { cerr <<
"DEBUG: read and write FREE" 237 <<
" if available" << endl; }
238 if (is.hasfree()) { sff::FREE free; is >> free; os << free; }
std::vector< std::string > Tvecofstrings