From a013b520ba151b9da3adec97d124676a96741b04 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 14 Sep 2004 04:47:41 -0400 Subject: python integrated both ways (see sample.dat), and initialized on-demand --- textual.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'textual.cc') diff --git a/textual.cc b/textual.cc index 53310a63..6e80884b 100644 --- a/textual.cc +++ b/textual.cc @@ -7,6 +7,9 @@ #include "option.h" #include "timing.h" #include "util.h" +#ifdef USE_BOOST_PYTHON +#include "python.h" +#endif #include #include @@ -534,9 +537,11 @@ unsigned int textual_parser_t::parse(std::istream& in, break; } - case '!': // directive - in >> line; - if (std::string(line) == "!include") { + case '!': { // directive + std::string word; + in.get(c); + in >> word; + if (word == "include") { in.getline(line, MAX_LINE); linenum++; @@ -545,7 +550,14 @@ unsigned int textual_parser_t::parse(std::istream& in, count += parse_journal_file(skip_ws(line), journal, account_stack.front()); } +#ifdef USE_BOOST_PYTHON + else if (word == "python") { + in.getline(line, MAX_LINE); + python_eval(in); + } +#endif break; + } default: { unsigned int first_line = linenum; -- cgit v1.2.3