From 4b562428341e909e5461de6e3b0757c3ad5dee55 Mon Sep 17 00:00:00 2001 From: Toru Shiozaki Date: Wed, 25 Jul 2018 17:17:21 -0500 Subject: [PATCH] changes for exception handling (it was broken) to be cherry picked by master --- src/global.h | 2 +- src/main.cc | 11 +++++------ src/run_bagel.cc | 3 ++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/global.h b/src/global.h index 9bb5904a1..359e13a6c 100644 --- a/src/global.h +++ b/src/global.h @@ -34,7 +34,7 @@ namespace bagel { -void static_variables(); +extern void static_variables(); static void print_header() { std::cout << std::endl; diff --git a/src/main.cc b/src/main.cc index 90039abc7..b7f21e054 100644 --- a/src/main.cc +++ b/src/main.cc @@ -34,13 +34,12 @@ using namespace std; using namespace bagel; int main(int argc, char** argv) { - const bool input_provided = argc == 2; - if (!input_provided) { - throw runtime_error("no input file provided"); - } - const string input = argv[1]; - try { + const bool input_provided = argc == 2; + if (!input_provided) + throw runtime_error("no input file provided"); + const string input = argv[1]; + // this is the main driver bagel::run_bagel_from_input(input); } catch (const Termination& e) { diff --git a/src/run_bagel.cc b/src/run_bagel.cc index 05f4b6206..d8adee64f 100644 --- a/src/run_bagel.cc +++ b/src/run_bagel.cc @@ -46,12 +46,14 @@ namespace bagel { namespace impl { void bagel::run_bagel_from_input(const string& input) { + static_variables(); auto idata = make_shared(input); impl::run_bagel_(idata); } void bagel::run_bagel_from_json(const string& input) { + static_variables(); stringstream ss; ss << input; auto idata = make_shared(ss); impl::run_bagel_(idata); @@ -60,7 +62,6 @@ void bagel::run_bagel_from_json(const string& input) { void bagel::impl::run_bagel_(shared_ptr idata) { - static_variables(); print_header(); shared_ptr geom;