From 935f849c7d1e076d994b7ec337ae82b2838ba6f9 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 28 Feb 2006 01:11:23 +0000 Subject: (parse_transaction): Assign the entry to an xact while parsing it so that the 'd' variable is available to value expressions within a transaction amount or cost. --- textual.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'textual.cc') diff --git a/textual.cc b/textual.cc index d5dbe3d7..258157c3 100644 --- a/textual.cc +++ b/textual.cc @@ -171,10 +171,13 @@ value_expr_t * parse_amount(const char * text, amount_t& amt, return expr; } -transaction_t * parse_transaction(char * line, account_t * account) +transaction_t * parse_transaction(char * line, account_t * account, + entry_t * entry = NULL) { // The account will be determined later... std::auto_ptr xact(new transaction_t(NULL)); + if (entry) + xact->entry = entry; // The call to `next_element' will skip past the account name, and // return a pointer to the beginning of the amount. Once we know @@ -455,7 +458,7 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master, break; } - if (transaction_t * xact = parse_transaction(line, master)) { + if (transaction_t * xact = parse_transaction(line, master, curr.get())) { if (state != transaction_t::UNCLEARED && xact->state == transaction_t::UNCLEARED) xact->state = state; -- cgit v1.2.3