From 7f57a915cee3c91cddd166fe9964655696666c4b Mon Sep 17 00:00:00 2001 From: dos-reis Date: Wed, 26 Jun 2013 11:43:56 +0000 Subject: Rewrite s-expression reader. --- src/gui/main-window.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/gui/main-window.cc') 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 #include +#include +#include +#include #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() { -- cgit v1.2.3