summaryrefslogtreecommitdiff
path: root/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'main.cc')
-rw-r--r--main.cc32
1 files changed, 23 insertions, 9 deletions
diff --git a/main.cc b/main.cc
index 2d4f6725..a732ae19 100644
--- a/main.cc
+++ b/main.cc
@@ -1,8 +1,6 @@
-#include <fstream>
-
#include "ledger.h"
-#include <pcre.h> // Perl regular expression library
+#include <fstream>
namespace ledger {
extern bool parse_ledger(std::istream& in);
@@ -33,19 +31,21 @@ void show_help(std::ostream& out)
int main(int argc, char *argv[])
{
- // Global defaults
-
- commodity * usd = new commodity("$", true, false, true, false, 2);
- commodities.insert(commodities_entry("USD", usd));
-
// Parse the command-line options
std::istream * file = NULL;
+#ifdef HUQUQULLAH
+ compute_huquq = true;
+#endif
+
int c;
- while (-1 != (c = getopt(argc, argv, "+hwf:"))) {
+ while (-1 != (c = getopt(argc, argv, "+hHwf:"))) {
switch (char(c)) {
case 'h': show_help(std::cout); break;
+#ifdef HUQUQULLAH
+ case 'H': compute_huquq = false; break;
+#endif
case 'w': use_warnings = true; break;
case 'f': file = new std::ifstream(optarg); break;
}
@@ -75,6 +75,20 @@ int main(int argc, char *argv[])
return 1;
}
+ // Global defaults
+
+ commodity * usd = new commodity("$", true, false, true, false, 2);
+ commodities.insert(commodities_entry("USD", usd));
+
+#ifdef HUQUQULLAH
+ if (compute_huquq) {
+ new commodity("H", true, true, true, false, 2);
+ new commodity("mithqal", false, true, true, false, 1);
+
+ read_regexps(".huquq", huquq_categories);
+ }
+#endif
+
// Parse the ledger
char buf[32];