SFF++ library: reading and writing SFF from C++

◆ main()

int main ( int  iargc,
char *  argv[] 
)

Definition at line 419 of file sfftest.cc.

References Options::debug, Options::extended, Options::internals, test_extended_functions(), test_internals(), test_line_functions(), test_read_file(), test_skip_trace(), test_verbose_functions(), test_waveform_normalizer(), test_write_file(), test_write_wrappers(), and Options::verbose.

420 {
421 
422  // define usage information
423  char usage_text[]=
424  {
425  "usage: sfftest [-D] [-v] [-x] [-i]" "\n"
426  " or: sfftest --help|-h" "\n"
427  };
428 
429  // define full help text
430  char help_text[]=
431  {
432  "-D produce debug output" "\n"
433  "notice: you have to pass at least one dummy argument to make" "\n"
434  "the program run" "\n"
435  "-v test verbose output" "\n"
436  "-x test extended WIDX format" "\n"
437  "-i test library internals" "\n"
438  };
439 
440  // define commandline options
441  using namespace tfxx::cmdline;
442  static Declare options[]=
443  {
444  // 0: print help
445  {"help",arg_no,"-"},
446  // 1: debug mode
447  {"D",arg_no,"-"},
448  // 2: test verbose functions
449  {"v",arg_no,"-"},
450  // 3: test WIDX
451  {"x",arg_no,"-"},
452  // 4: test internals
453  {"i",arg_no,"-"},
454  {NULL}
455  };
456 
457  // no arguments? print usage...
458  if (iargc<2)
459  {
460  cerr << usage_text << endl;
461  exit(0);
462  }
463 
464  // collect options from commandline
465  Commandline cmdline(iargc, argv, options);
466 
467  // help requested? print full help text...
468  if (cmdline.optset(0))
469  {
470  cerr << usage_text << endl;
471  cerr << help_text << endl;
472  exit(0);
473  }
474 
475  Options opt;
476  opt.debug=cmdline.optset(1);
477  opt.verbose=cmdline.optset(2);
478  opt.extended=cmdline.optset(3);
479  opt.internals=cmdline.optset(4);
480 
481  if (opt.verbose)
482  {
483  test_verbose_functions(); cout << endl;
484  }
485  else if (opt.extended)
486  {
487  test_extended_functions(); cout << endl;
488  }
489  else if (opt.internals)
490  {
491  test_internals(); cout << endl;
492  }
493  else
494  {
495  test_line_functions(); cout << endl;
496  test_write_wrappers(); cout << endl;
497  test_waveform_normalizer(); cout << endl;
498  test_write_file(); cout << endl;
499  test_read_file(opt.debug); cout << endl;
500  test_skip_trace(); cout << endl;
501  }
502 }
void test_extended_functions()
Definition: sfftest.cc:59
void test_skip_trace()
Definition: sfftest.cc:366
void test_write_wrappers()
Definition: sfftest.cc:168
bool extended
Definition: sfftest.cc:416
void test_verbose_functions()
Definition: sfftest.cc:127
void test_line_functions()
Definition: sfftest.cc:86
void test_waveform_normalizer()
Definition: sfftest.cc:223
bool debug
Definition: sfftest.cc:416
void test_read_file(const bool &debug)
Definition: sfftest.cc:312
bool verbose
Definition: sfftest.cc:416
void test_internals()
Definition: sfftest.cc:50
bool internals
Definition: sfftest.cc:416
void test_write_file()
Definition: sfftest.cc:266
Here is the call graph for this function: