Fawkes API  Fawkes Development Version
main.cpp
1 
2 /***************************************************************************
3  * main.cpp - Fawkes main application
4  *
5  * Created: Thu Nov 2 16:44:48 2006
6  * Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <baseapp/run.h>
25 #include <core/exception.h>
26 #include <cstdio>
27 
28 
29 /** Fawkes application.
30  * @param argc argument count
31  * @param argv array of arguments
32  */
33 int
34 main(int argc, char **argv)
35 {
36  try {
37  int retval = 0;
38  if (! fawkes::runtime::init(argc, argv, retval)) {
39  return retval;
40  }
41  fawkes::runtime::run();
42  fawkes::runtime::cleanup();
43  } catch (fawkes::Exception &e) {
44  printf("Fawkes execution ended unexpectedly, exception follows.\n");
45  e.print_trace();
46  return 1;
47  }
48 
49  return 0;
50 }
Base class for exceptions in Fawkes.
Definition: exception.h:36
void print_trace()
Prints trace to stderr.
Definition: exception.cpp:619