summaryrefslogtreecommitdiff
path: root/binary.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-02-16 21:10:50 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:24 -0400
commitf43370cae5d9297487fedeefa427d42ab869df48 (patch)
tree247b3e1f9628fd62e19f0758d8f7265308b1d8e2 /binary.cc
parentb0414258467a1216f69dc01ae7a7ad8af2751b8b (diff)
downloadfork-ledger-f43370cae5d9297487fedeefa427d42ab869df48.tar.gz
fork-ledger-f43370cae5d9297487fedeefa427d42ab869df48.tar.bz2
fork-ledger-f43370cae5d9297487fedeefa427d42ab869df48.zip
Transactions now track their beginning and ending position, as do
entries. The new format strings %xB %xE %xb %xe can be used to display those values relative to a transaction. The Emacs module now relies on this support to exactly determine where a transaction is, rather than the Elisp logic it relied on previously.
Diffstat (limited to 'binary.cc')
-rw-r--r--binary.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/binary.cc b/binary.cc
index 687f3540..fd22c443 100644
--- a/binary.cc
+++ b/binary.cc
@@ -12,9 +12,9 @@ namespace ledger {
static unsigned long binary_magic_number = 0xFFEED765;
#ifdef DEBUG_ENABLED
-static unsigned long format_version = 0x00020501;
+static unsigned long format_version = 0x00020503;
#else
-static unsigned long format_version = 0x00020500;
+static unsigned long format_version = 0x00020502;
#endif
static account_t ** accounts;
@@ -198,6 +198,10 @@ inline void read_binary_transaction(char *& data, transaction_t * xact)
read_binary_number(data, xact->flags);
xact->flags |= TRANSACTION_BULK_ALLOC;
read_binary_string(data, &xact->note);
+ read_binary_number(data, xact->beg_pos);
+ read_binary_number(data, xact->beg_line);
+ read_binary_number(data, xact->end_pos);
+ read_binary_number(data, xact->end_line);
xact->data = NULL;
}
@@ -564,6 +568,10 @@ void write_binary_transaction(std::ostream& out, transaction_t * xact)
write_binary_number(out, xact->state);
write_binary_number(out, xact->flags);
write_binary_string(out, xact->note);
+ write_binary_number<istream_pos_type>(out, xact->beg_pos);
+ write_binary_number<unsigned long>(out, xact->beg_line);
+ write_binary_number<istream_pos_type>(out, xact->end_pos);
+ write_binary_number<unsigned long>(out, xact->end_line);
}
void write_binary_entry_base(std::ostream& out, entry_base_t * entry)