2 #include <msp/io/print.h>
3 #include "application.h"
10 Application *Application::app_ = 0;
11 Application::Starter *Application::starter_ = 0;
12 void *Application::data_ = 0;
14 Application::Application():
18 int Application::run(int argc, char **argv, void *data)
20 static bool called = false;
23 IO::cerr.write("Trying to call Application::run_app twice!\n");
30 IO::cerr.write("Trying to run with no RegisteredApplication class!\n");
40 app_ = starter_->create_app(argc, argv);
42 catch(const usage_error &e)
44 IO::print(IO::cerr, "%s\n%s\n", e.what(), e.help());
48 int result = app_->main();
49 Application *a = app_;
54 catch(const exception &e)
64 int Application::main()
73 void Application::catch_signal(int s)
75 signal(s, &sighandler_);
78 void Application::exit(int c)
84 void Application::sighandler_(int s)
90 Application::Starter::Starter()
93 throw logic_error("Can't create more than one Starter instance");