From 0e2a3a9c0053a7f091a8b941a452120b6066b761 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 5 Feb 2009 04:06:58 -0400 Subject: Moved much of the main.cc code into a new global_scope_t class. --- src/main.cc | 311 +++++++++++++++++++++++++++++---------------------------- src/session.cc | 4 - src/textual.cc | 7 ++ src/work.cc | 22 ---- src/work.h | 1 - 5 files changed, 168 insertions(+), 177 deletions(-) (limited to 'src') diff --git a/src/main.cc b/src/main.cc index 207582e2..061d6b2d 100644 --- a/src/main.cc +++ b/src/main.cc @@ -44,8 +44,12 @@ namespace { public: path script_file; - global_scope_t() { + global_scope_t(char ** envp) + { + TRACE_CTOR(global_scope_t, ""); + session_ptr.reset(new LEDGER_SESSION_T); + set_session_context(session_ptr.get()); // Create the report object, which maintains state relating to each @@ -54,21 +58,45 @@ namespace { // a GUI were calling into Ledger it would have one session object per // open document, with a separate report_t object for each report it // generated. - report_stack.push_front(new report_t(*session_ptr.get())); + report_stack.push_front(new report_t(session())); + + // Read the user's options, in the following order: + // + // 1. environment variables (LEDGER_