summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2003-10-10 18:53:27 +0000
committerJohn Wiegley <johnw@newartisans.com>2003-10-10 18:53:27 +0000
commit60fa58e847fd8368059e13e6d9b941fc0e75291b (patch)
tree42631fa16ccb3ed77a49497d8a6e43115c58831c
parent2835be562889c4e4dd11205533cca54ae02042e1 (diff)
downloadfork-ledger-60fa58e847fd8368059e13e6d9b941fc0e75291b.tar.gz
fork-ledger-60fa58e847fd8368059e13e6d9b941fc0e75291b.tar.bz2
fork-ledger-60fa58e847fd8368059e13e6d9b941fc0e75291b.zip
*** empty log message ***
-rw-r--r--amount.cc9
-rw-r--r--gnucash.cc2
-rw-r--r--ledger.cc10
-rw-r--r--ledger.h10
-rw-r--r--reports.cc7
5 files changed, 20 insertions, 18 deletions
diff --git a/amount.cc b/amount.cc
index d7cf0d88..1f76d64f 100644
--- a/amount.cc
+++ b/amount.cc
@@ -547,16 +547,11 @@ static commodity * parse_amount(mpz_t out, const char * num,
if (saw_commodity) {
commodities_map_iterator item =
main_ledger->commodities.find(symbol.c_str());
- if (item == main_ledger->commodities.end()) {
+ if (item == main_ledger->commodities.end())
comm = new commodity(symbol, prefix, separate,
thousands, european, precision);
- } else {
+ else
comm = (*item).second;
-
- if (use_warnings && precision > comm->precision)
- std::cerr << "Warning: Use of higher precision than expected: "
- << value_str << std::endl;
- }
}
parse_number(out, value_str.c_str(), comm);
diff --git a/gnucash.cc b/gnucash.cc
index 6b432a78..dad7b38a 100644
--- a/gnucash.cc
+++ b/gnucash.cc
@@ -273,6 +273,8 @@ book * parse_gnucash(std::istream& in, bool compute_balances)
curr_account_id.clear();
curr_quant.clear();
+ main_ledger->commodities.erase("USD");
+
return ledger;
}
diff --git a/ledger.cc b/ledger.cc
index b77b8856..d0006d0b 100644
--- a/ledger.cc
+++ b/ledger.cc
@@ -4,7 +4,6 @@
namespace ledger {
-bool use_warnings = false;
book * main_ledger;
commodity::~commodity()
@@ -251,6 +250,15 @@ mask::mask(const std::string& pat) : exclude(false)
<< std::endl;
}
+mask::mask(const mask& m) : exclude(m.exclude), pattern(m.pattern)
+{
+ const char *error;
+ int erroffset;
+ regexp = pcre_compile(pattern.c_str(), PCRE_CASELESS,
+ &error, &erroffset, NULL);
+ assert(regexp);
+}
+
void read_regexps(const std::string& path, regexps_map& regexps)
{
if (access(path.c_str(), R_OK) != -1) {
diff --git a/ledger.h b/ledger.h
index 2be93f12..83ca9693 100644
--- a/ledger.h
+++ b/ledger.h
@@ -1,5 +1,5 @@
#ifndef _LEDGER_H
-#define _LEDGER_H "$Revision: 1.23 $"
+#define _LEDGER_H "$Revision: 1.24 $"
//////////////////////////////////////////////////////////////////////
//
@@ -93,9 +93,6 @@ extern amount * create_amount(const std::string& value,
class mask
{
- // jww (2003-10-08): need to correct this
- //mask(const mask&);
-
public:
bool exclude;
std::string pattern;
@@ -103,11 +100,11 @@ class mask
explicit mask(const std::string& pattern);
-#if 0
+ mask(const mask&);
+
~mask() {
pcre_free(regexp);
}
-#endif
bool match(const std::string& str) const;
};
@@ -287,7 +284,6 @@ class book
};
extern book * main_ledger;
-extern bool use_warnings;
inline commodity::commodity(const std::string& sym, bool pre, bool sep,
bool thou, bool euro, int prec)
diff --git a/reports.cc b/reports.cc
index b46d360e..175a7d4d 100644
--- a/reports.cc
+++ b/reports.cc
@@ -393,7 +393,7 @@ int main(int argc, char * argv[])
// Parse the command-line options
int c;
- while (-1 != (c = getopt(argc, argv, "+b:e:d:cChRV:wf:i:p:PvsSEnF"))) {
+ while (-1 != (c = getopt(argc, argv, "+b:e:d:cChRV:f:i:p:PvsSEnF"))) {
switch (char(c)) {
case 'b':
case 'e': {
@@ -473,7 +473,6 @@ int main(int argc, char * argv[])
case 'C': show_cleared = true; break;
case 'R': show_virtual = false; break;
- case 'w': use_warnings = true; break;
case 's': show_children = true; break;
case 'S': show_sorted = true; break;
case 'E': show_empty = true; break;
@@ -516,7 +515,8 @@ int main(int argc, char * argv[])
index = optind;
- if (use_warnings && (have_beginning || have_ending)) {
+#if 0
+ if (have_beginning || have_ending) {
std::cout << "Reporting";
if (have_beginning) {
@@ -533,6 +533,7 @@ int main(int argc, char * argv[])
std::cout << std::endl;
}
+#endif
// A ledger data file must be specified