Commit afdf1697 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1784
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 0108b9aa
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tidofi.cc,v 1.1 2004-02-19 16:16:00 tforb Exp $
* $Id: tidofi.cc,v 1.2 2005-06-30 12:47:54 tforb Exp $
* \author Thomas Forbriger
* \date 17/02/2004
*
......@@ -19,15 +19,29 @@
#define TIDOFI_VERSION \
"TIDOFI V1.0 time domain filter"
#define TIDOFI_CVSID \
"$Id: tidofi.cc,v 1.1 2004-02-19 16:16:00 tforb Exp $"
"$Id: tidofi.cc,v 1.2 2005-06-30 12:47:54 tforb Exp $"
#include <iostream>
#include <tfxx/commandline.h>
#include <tfxx/xcmdline.h>
#include <tfxx/error.h>
using std::cout;
using std::cerr;
using std::endl;
/*----------------------------------------------------------------------*/
struct Options {
bool verbose;
bool overwrite;
bool readcommandfile;
std::string commandfile;
bool readstdin;
}; // struct Options
/*======================================================================*/
int main(int iargc, char* argv[])
{
......@@ -35,7 +49,8 @@ int main(int iargc, char* argv[])
char usage_text[]=
{
TIDOFI_VERSION "\n"
"usage: tidofi" "\n"
"usage: tidofi [-v] [-o] [-cf file] [-cs]" "\n"
" outfile infile [t:T] [infile [t:T] ... ]" "\n"
" or: tidofi --help|-h" "\n"
};
......@@ -43,6 +58,15 @@ int main(int iargc, char* argv[])
char help_text[]=
{
TIDOFI_CVSID
"\n"
"outfile name of file to contain results" "\n"
"infile input file" "\n"
" t:T select traces T, where T may be any range" "\n"
" specification like \'3-4\' or \'5,6,7-12,20\'" "\n"
"-v be verbose" "\n"
"-o overwrite output" "\n"
"-cf file read filter commands from \"file\"" "\n"
"-cs read filter commands from stdin" "\n"
};
// define commandline options
......@@ -53,9 +77,18 @@ int main(int iargc, char* argv[])
{"help",arg_no,"-"},
// 1: verbose mode
{"v",arg_no,"-"},
// 2: overwrite mode
{"o",arg_no,"-"},
// 3: command file
{"cf",arg_yes,"-"},
// 4: stdin mode
{"cs",arg_no,"-"},
{NULL}
};
// define commandlien argument modifier keys
static const char* cmdlinekeys[]={"t", 0};
// no arguments? print usage...
if (iargc<2)
{
......@@ -74,27 +107,19 @@ int main(int iargc, char* argv[])
exit(0);
}
// dummy operation: print option settings
for (int iopt=0; iopt<2; iopt++)
{
cout << "option: '" << options[iopt].opt_string << "'" << endl;
if (cmdline.optset(iopt)) { cout << " option was set"; }
else { cout << "option was not set"; }
cout << endl;
cout << " argument (string): '" << cmdline.string_arg(iopt) << "'" << endl;
cout << " argument (int): '" << cmdline.int_arg(iopt) << "'" << endl;
cout << " argument (long): '" << cmdline.long_arg(iopt) << "'" << endl;
cout << " argument (float): '" << cmdline.float_arg(iopt) << "'" << endl;
cout << " argument (double): '" << cmdline.double_arg(iopt) << "'" << endl;
cout << " argument (bool): '";
if (cmdline.bool_arg(iopt))
{ cout << "true"; } else { cout << "false"; }
cout << "'" << endl;
}
while (cmdline.extra()) { cout << cmdline.next() << endl; }
// extract commandline options
Options opt;
opt.verbose=cmdline.optset(1);
opt.overwrite=cmdline.optset(2);
opt.readcommandfile=cmdline.optset(3);
opt.commandfile=cmdline.string_arg(3);
opt.readstdin=cmdline.optset(4);
// dummy operation: print rest of command line
while (cmdline.extra()) { cout << cmdline.next() << endl; }
// extract commandline arguments
TFXX_assert(cmdline.extra(), "missing output file");
std::string outfile=cmdline.next();
TFXX_assert(cmdline.extra(), "missing input file");
tfxx::cmdline::Tparsed arguments=parse_cmdline(cmdline, cmdlinekeys);
}
/* ----- END OF tidofi.cc ----- */
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