diff options
author | John Wiegley <johnw@newartisans.com> | 2008-07-21 20:41:42 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-07-21 20:41:42 -0400 |
commit | aa4f0d4364783ed5cbc97972755c7fd6b0da3cf0 (patch) | |
tree | 51c223e4f7dc4226831ae15330d424ff610a018f /main.cc | |
parent | 8601a2a8bfd63b54a8c65d34ad021cbe2270d201 (diff) | |
download | fork-ledger-aa4f0d4364783ed5cbc97972755c7fd6b0da3cf0.tar.gz fork-ledger-aa4f0d4364783ed5cbc97972755c7fd6b0da3cf0.tar.bz2 fork-ledger-aa4f0d4364783ed5cbc97972755c7fd6b0da3cf0.zip |
Added the var_t helper class, which can be seen in the beginning
implementation of register_command in main.cc.
Diffstat (limited to 'main.cc')
-rw-r--r-- | main.cc | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -45,6 +45,17 @@ #include <fdstream.hpp> #endif +namespace ledger { + value_t register_command(expr::call_scope_t& args) + { + expr::var_t<std::ostream> ostream(args, "ostream"); + + *ostream << "This (will be) the register command.\n"; + + return true; + } +} + static int read_and_report(ledger::report_t& report, int argc, char * argv[], char * envp[]) { @@ -109,9 +120,9 @@ static int read_and_report(ledger::report_t& report, int argc, char * argv[], expr::function_t command; -#if 0 if (verb == "register" || verb == "reg" || verb == "r") - command = register_command(); + command = register_command; +#if 0 else if (verb == "balance" || verb == "bal" || verb == "b") command = balance_command(); else if (verb == "print" || verb == "p") @@ -132,12 +143,8 @@ static int read_and_report(ledger::report_t& report, int argc, char * argv[], command = csv_command(); else if (verb == "emacs" || verb == "lisp") command = emacs_command(); - else -#endif - if (verb == "xml") -#if 0 + else if (verb == "xml") command = bind(xml_command, _1); -#else ; #endif else if (verb == "expr") @@ -297,7 +304,7 @@ static int read_and_report(ledger::report_t& report, int argc, char * argv[], // Create an argument scope containing the report command's // arguments, and then invoke the command. - expr::call_scope_t command_args(*expr::global_scope); + expr::call_scope_t command_args(report); for (strings_list::iterator i = arg; i != args.end(); i++) command_args.push_back(value_t(*i, true)); |