1 #include <boost/filesystem/operations.hpp>
3 #include <boost/python.hpp>
6 using namespace boost::filesystem;
10 #include <QApplication>
12 #include "qui/MussaWindow.hpp"
13 #include "alg/parse_options.hpp"
14 #include "mussa_exceptions.hpp"
16 int main(int argc, char **argv)
20 // if we're under unix and don't have a display, see if we can still run
22 opts.useGUI = getenv("DISPLAY") != 0;
25 QApplication app(argc, argv, opts.useGUI);
26 Q_INIT_RESOURCE(icons);
28 initialize_mussa(opts, argc, argv);
30 if (opts.analysis == 0) {
36 if (opts.runAsPythonInterpeter) {
38 boost::python::object main_module((boost::python::handle<>(boost::python::borrowed(PyImport_AddModule("__main__")))));
39 boost::python::object main_namespace = main_module.attr("__dict__");
41 boost::python::handle<> ignored((PyRun_String(
42 //"from IPython.Shell import IPShellEmbed\n"
43 //"shell = IPShellEmbed(['mussa'], '')\n",
47 " print 'the square is %d' % (r)\n"
53 boost::python::object square = main_module.attr("square");
54 int result = boost::python::extract<int>(square(3));
55 std::cout << "C++ has " << result << std::endl;
56 PyRun_InteractiveLoop(stdin, "mussa");
58 #endif /* USE_PYTHON */
60 MussaWindow win(opts.analysis);
65 } catch (mussa_error e) {
67 } catch (boost::filesystem::filesystem_error e) {
71 catch (boost::python::error_already_set e) {
74 #endif /* USE_PYTHON */
75 catch (std::runtime_error e) {
78 qFatal("unrecognized exception");