summaryrefslogtreecommitdiff
path: root/textual.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-09-14 04:47:41 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-09-14 04:47:41 -0400
commita013b520ba151b9da3adec97d124676a96741b04 (patch)
tree4ee4d75800f9b9dd08c95283212fbdb7c71c1aee /textual.cc
parent6c66d1e0ef09f113bca11cfb5ef0f35eebcc61a3 (diff)
downloadfork-ledger-a013b520ba151b9da3adec97d124676a96741b04.tar.gz
fork-ledger-a013b520ba151b9da3adec97d124676a96741b04.tar.bz2
fork-ledger-a013b520ba151b9da3adec97d124676a96741b04.zip
python integrated both ways (see sample.dat), and initialized on-demand
Diffstat (limited to 'textual.cc')
-rw-r--r--textual.cc18
1 files changed, 15 insertions, 3 deletions
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 <fstream>
#include <sstream>
@@ -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;