summaryrefslogtreecommitdiff
path: root/gnucash.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-02-25 10:55:49 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:26 -0400
commit13f375ae582cfda3753bf8430a84cc7c7216915c (patch)
treecd0dd475208cb9af1e8f2c95530d7ca4b73ad766 /gnucash.cc
parent793dbf26d9af5e052afd2bc5855053f5652ff5b8 (diff)
downloadfork-ledger-13f375ae582cfda3753bf8430a84cc7c7216915c.tar.gz
fork-ledger-13f375ae582cfda3753bf8430a84cc7c7216915c.tar.bz2
fork-ledger-13f375ae582cfda3753bf8430a84cc7c7216915c.zip
*** no comment ***
Diffstat (limited to 'gnucash.cc')
-rw-r--r--gnucash.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/gnucash.cc b/gnucash.cc
index 8b27490c..4b537959 100644
--- a/gnucash.cc
+++ b/gnucash.cc
@@ -45,9 +45,11 @@ static std::istream * instreamp;
static unsigned int offset;
static XML_Parser parser;
static std::string path;
+#ifdef USE_EDITOR
static unsigned int src_idx;
static istream_pos_type beg_pos;
static unsigned long beg_line;
+#endif
static transaction_t::state_t curr_state;
@@ -146,11 +148,13 @@ static void endElement(void *userData, const char *name)
have_error = "The above entry does not balance";
delete curr_entry;
} else {
+#ifdef USE_EDITOR
curr_entry->src_idx = src_idx;
curr_entry->beg_pos = beg_pos;
curr_entry->beg_line = beg_line;
curr_entry->end_pos = instreamp->tellg();
curr_entry->end_line = XML_GetCurrentLineNumber(parser) - offset;
+#endif
count++;
}
@@ -189,10 +193,12 @@ static void endElement(void *userData, const char *name)
if (value != curr_value)
xact->cost = new amount_t(curr_value);
+#ifdef USE_EDITOR
xact->beg_pos = beg_pos;
xact->beg_line = beg_line;
xact->end_pos = instreamp->tellg();
xact->end_line = XML_GetCurrentLineNumber(parser) - offset;
+#endif
// Clear the relevant variables for the next run
curr_state = transaction_t::UNCLEARED;
@@ -376,7 +382,9 @@ unsigned int gnucash_parser_t::parse(std::istream& in,
instreamp = &in;
path = original_file ? *original_file : "<gnucash>";
+#ifdef USE_EDITOR
src_idx = journal->sources.size() - 1;
+#endif
// GnuCash uses the USD commodity without defining it, which really
// means $.
@@ -393,8 +401,10 @@ unsigned int gnucash_parser_t::parse(std::istream& in,
XML_SetCharacterDataHandler(parser, dataHandler);
while (in.good() && ! in.eof()) {
+#ifdef USE_EDITOR
beg_pos = in.tellg();
beg_line = (XML_GetCurrentLineNumber(parser) - offset) + 1;
+#endif
in.getline(buf, BUFSIZ - 1);
std::strcat(buf, "\n");