diff options
author | dos-reis <gdr@axiomatics.org> | 2013-06-26 11:43:56 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-06-26 11:43:56 +0000 |
commit | 7f57a915cee3c91cddd166fe9964655696666c4b (patch) | |
tree | d00aa4323f8dc4280e736c5e15ee8479f89eb31b /src/gui/main-window.cc | |
parent | f9e4a03a220766099d6b5fc683a58185c4805a05 (diff) | |
download | open-axiom-7f57a915cee3c91cddd166fe9964655696666c4b.tar.gz |
Rewrite s-expression reader.
Diffstat (limited to 'src/gui/main-window.cc')
-rw-r--r-- | src/gui/main-window.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gui/main-window.cc b/src/gui/main-window.cc index 6d3eb205..1ef6ec56 100644 --- a/src/gui/main-window.cc +++ b/src/gui/main-window.cc @@ -36,10 +36,33 @@ #include <QMessageBox> #include <QScrollBar> +#include <open-axiom/diagnostics> +#include <open-axiom/sexpr> +#include <open-axiom/FileMapping> #include "debate.h" #include "main-window.h" namespace OpenAxiom { + void + MainWindow::display_error(const std::string& s) { + QMessageBox::critical(this, tr("System error"), QString(s.c_str())); + } + + void + MainWindow::read_databases() { + try { + const auto& fs = server()->system_root(); + Memory::FileMapping db { fs.dbdir() + "/interp.daase" }; + Sexpr::Reader rd { db.begin(), db.end() }; + while (rd.read()) + ; + } + catch(const Diagnostics::BasicError& e) { + display_error(e.message()); + } + } + + static void connect_server_io(MainWindow* win, Debate* debate) { QObject::connect(win->server(), SIGNAL(readyReadStandardError()), win, SLOT(display_error())); @@ -70,6 +93,7 @@ namespace OpenAxiom { // wait to be pinged before displaying a prompt. This is // an unfortunate result of a rather awkward hack. server()->input(""); + read_databases(); } MainWindow::~MainWindow() { |