diff options
author | John Wiegley <johnw@newartisans.com> | 2008-07-29 05:10:16 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-07-29 05:59:38 -0400 |
commit | 4518ea95408e2d5fe90a87159b88bb41734ec1dc (patch) | |
tree | 3026169803aaea580d8b452cb9bb8a569c92fb2a /session.h | |
parent | 63039ade9209bced70b3e4dbb673ad90286d310a (diff) | |
download | fork-ledger-4518ea95408e2d5fe90a87159b88bb41734ec1dc.tar.gz fork-ledger-4518ea95408e2d5fe90a87159b88bb41734ec1dc.tar.bz2 fork-ledger-4518ea95408e2d5fe90a87159b88bb41734ec1dc.zip |
Value expression architecture is now rewritten, but the functionality of the
old system (for example, the meaning of 'a') has yet to be restored. In the
new scheme, this will be done by definition a function outside of the value
expression logic, rather than the tight coupling between journal innards and
value expressions that occurred in 2.x.
Diffstat (limited to 'session.h')
-rw-r--r-- | session.h | 41 |
1 files changed, 23 insertions, 18 deletions
@@ -32,15 +32,20 @@ #ifndef _SESSION_H #define _SESSION_H -#include "valexpr.h" +#include "scope.h" #include "journal.h" -#include "parser.h" namespace ledger { -class session_t : public expr::symbol_scope_t +class session_t : public symbol_scope_t { - public: + static void initialize(); + static void shutdown(); + + friend void set_session_context(session_t * session); + friend void release_session_context(); + +public: static session_t * current; path data_file; @@ -76,8 +81,8 @@ class session_t : public expr::symbol_scope_t bool ansi_codes; bool ansi_invert; - ptr_list<journal_t> journals; - ptr_list<parser_t> parsers; + ptr_list<journal_t> journals; + ptr_list<journal_t::parser_t> parsers; account_t * master; mutable accounts_map accounts_cache; @@ -121,11 +126,11 @@ class session_t : public expr::symbol_scope_t std::size_t read_data(journal_t& journal, const string& master_account = ""); - void register_parser(parser_t * parser) { + void register_parser(journal_t::parser_t * parser) { parsers.push_back(parser); } - void unregister_parser(parser_t * parser) { - for (ptr_list<parser_t>::iterator i = parsers.begin(); + void unregister_parser(journal_t::parser_t * parser) { + for (ptr_list<journal_t::parser_t>::iterator i = parsers.begin(); i != parsers.end(); i++) if (&*i == parser) { @@ -167,13 +172,13 @@ class session_t : public expr::symbol_scope_t // Scope members // - virtual expr::ptr_op_t lookup(const string& name); + virtual expr_t::ptr_op_t lookup(const string& name); // // Help options // - value_t option_version(expr::scope_t&) { + value_t option_version(scope_t&) { std::cout << "Ledger " << ledger::version << ", the command-line accounting tool"; std::cout << "\n\nCopyright (c) 2003-2008, John Wiegley. All rights reserved.\n\n\ This program is made available under the terms of the BSD Public License.\n\ @@ -193,17 +198,17 @@ See LICENSE file included with the distribution for details and disclaimer.\n"; // Debug options // - value_t option_trace_(expr::scope_t& locals) { + value_t option_trace_(scope_t& locals) { return NULL_VALUE; } - value_t option_debug_(expr::scope_t& locals) { + value_t option_debug_(scope_t& locals) { return NULL_VALUE; } - value_t option_verify(expr::scope_t&) { + value_t option_verify(scope_t&) { return NULL_VALUE; } - value_t option_verbose(expr::scope_t&) { + value_t option_verbose(scope_t&) { #if defined(LOGGING_ON) if (_log_level < LOG_INFO) _log_level = LOG_INFO; @@ -215,7 +220,7 @@ See LICENSE file included with the distribution for details and disclaimer.\n"; // Option handlers // - value_t option_file_(expr::call_scope_t& args) { + value_t option_file_(call_scope_t& args) { assert(args.size() == 1); data_file = args[0].as_string(); return NULL_VALUE; @@ -223,11 +228,11 @@ See LICENSE file included with the distribution for details and disclaimer.\n"; #if 0 #if defined(USE_BOOST_PYTHON) - value_t option_import_(expr::call_scope_t& args) { + value_t option_import_(call_scope_t& args) { python_import(optarg); return NULL_VALUE; } - value_t option_import_stdin(expr::call_scope_t& args) { + value_t option_import_stdin(call_scope_t& args) { python_eval(std::cin, PY_EVAL_MULTI); return NULL_VALUE; } |