libpgplotxx.a (C++ interface to PGPLOT)

◆ main()

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

Definition at line 162 of file pgtestxx.cc.

References testhandle(), and pgplot::usage_escape_sequences.

163 {
164 
165  // define usage information
166  char usage_text[]=
167  {
168  PGTESTXX_VERSION "\n"
169  "usage: pgtestxx [-all] [-handle]" "\n"
170  " or: pgtestxx --help|-h" "\n"
171  };
172 
173  // define full help text
174  char help_text[]=
175  {
176  "\n"
177  "-all run all tests" "\n"
178  "-handle test Handle class template" "\n"
179  };
180 
181  // define commandline options
182  using namespace tfxx::cmdline;
183  static Declare options[]=
184  {
185  // 0: print help
186  {"help",arg_no,"-"},
187  // 1: verbose mode
188  {"verbose",arg_no,"-"},
189  // 2: test handle
190  {"handle",arg_no,"-"},
191  // 3: run all tests
192  {"all",arg_no,"-"},
193  {NULL}
194  };
195 
196  // no arguments? print usage...
197  if (iargc<2)
198  {
199  cerr << usage_text << endl;
200  exit(0);
201  }
202 
203  // collect options from commandline
204  Commandline cmdline(iargc, argv, options);
205 
206  // help requested? print full help text...
207  if (cmdline.optset(0))
208  {
209  cerr << usage_text << endl;
210  cerr << help_text << endl;
212  exit(0);
213  }
214 
215  /*
216  // dummy operation: print option settings
217  for (int iopt=0; iopt<2; iopt++)
218  {
219  cout << "option: '" << options[iopt].opt_string << "'" << endl;
220  if (cmdline.optset(iopt)) { cout << " option was set"; }
221  else { cout << "option was not set"; }
222  cout << endl;
223  cout << " argument (string): '" << cmdline.string_arg(iopt) << "'" << endl;
224  cout << " argument (int): '" << cmdline.int_arg(iopt) << "'" << endl;
225  cout << " argument (long): '" << cmdline.long_arg(iopt) << "'" << endl;
226  cout << " argument (float): '" << cmdline.float_arg(iopt) << "'" << endl;
227  cout << " argument (double): '" << cmdline.double_arg(iopt) << "'" << endl;
228  cout << " argument (bool): '";
229  if (cmdline.bool_arg(iopt))
230  { cout << "true"; } else { cout << "false"; }
231  cout << "'" << endl;
232  }
233  while (cmdline.extra()) { cout << cmdline.next() << endl; }
234 
235  // dummy operation: print rest of command line
236  while (cmdline.extra()) { cout << cmdline.next() << endl; }
237  */
238 
239  cout << PGTESTXX_VERSION << endl;
240  if (cmdline.optset(2) || cmdline.optset(3)) { testhandle(); }
241 }
const char *const usage_escape_sequences
usage text for escape sequences
Definition: pgplotxx.cc:46
void testhandle()
Test handles.
Definition: pgtestxx.cc:118
Here is the call graph for this function: