summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-08-03 22:30:43 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-08-03 22:30:43 -0400
commit8a21391d0a6d6187855b40530f25b1d8beb0d67a (patch)
tree93243e2aeb44daff01bbea26cf5d5988ad2a8e34
parentbbdab793029f156425180282e0e7a2a7090c1c4a (diff)
downloadfork-ledger-8a21391d0a6d6187855b40530f25b1d8beb0d67a.tar.gz
fork-ledger-8a21391d0a6d6187855b40530f25b1d8beb0d67a.tar.bz2
fork-ledger-8a21391d0a6d6187855b40530f25b1d8beb0d67a.zip
Got pre-compiled headers working again, which are used if --devel is passed to
acprep.
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am3
-rwxr-xr-xacprep5
-rwxr-xr-xmyacprep5
-rw-r--r--report.cc22
-rw-r--r--report.h5
-rw-r--r--xact.cc23
7 files changed, 47 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index a2dc7a58..a76601ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,6 +40,7 @@
/missing
/pending
/stamp-h1
+/system.hh.gch
/texinfo.tex
AUTHORS
INSTALL
diff --git a/Makefile.am b/Makefile.am
index 72ff6f38..80a0f1aa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -163,10 +163,9 @@ if USE_PCH
nodist_libledger_la_SOURCES = system.hh.gch
BUILT_SOURCES += system.hh.gch
-CLEANFILES += system.hh.gch system.hh
+CLEANFILES += system.hh.gch
$(top_builddir)/system.hh.gch: $(srcdir)/system.hh $(top_builddir)/acconf.h
- echo "#include \"$(srcdir)/system.hh\"" > $(top_builddir)/system.hh
$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(libledger_la_CPPFLAGS) \
$(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) \
diff --git a/acprep b/acprep
index 75226516..ff20b1fd 100755
--- a/acprep
+++ b/acprep
@@ -86,8 +86,7 @@ CXXFLAGS="$CXXFLAGS -Wwrite-strings"
while [ -n "$1" ]; do
case "$1" in
--devel)
- #SWITCHES="$SWITCHES --disable-shared --enable-pch"
- SWITCHES="$SWITCHES --disable-shared"
+ SWITCHES="$SWITCHES --disable-shared --enable-pch"
CPPFLAGS="$CPPFLAGS -DBOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING=1"
CPPFLAGS="$CPPFLAGS -DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE=1"
shift 1 ;;
@@ -161,7 +160,7 @@ fi
# errors and warnings much easier.
if [ -f Makefile ]; then
- perl -i -pe 's/^\t(\$\((LIBTOOL|CXX)\).*)/\t\@echo " " CXX \$\@;$1 > \/dev\/null/;' Makefile
+ perl -i -pe 's/^\t(\$\((LIBTOOL|CXX)\).*?\.cc)$/\t\@echo " " CXX \$\@;$1 > \/dev\/null/;' Makefile
perl -i -pe 's/^\tmv -f/\t\@mv -f/;' Makefile
perl -i -pe 's/^\t(\$\((.*?)LINK\).*)/\t\@echo " " LD \$\@;$1 > \/dev\/null/;' Makefile
fi
diff --git a/myacprep b/myacprep
new file mode 100755
index 00000000..745c9edd
--- /dev/null
+++ b/myacprep
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# This is how I run acprep on my OS X Leopard machine.
+
+./acprep --local --devel --debug --boost mt-1_35
diff --git a/report.cc b/report.cc
index f250a1c4..f746b3a0 100644
--- a/report.cc
+++ b/report.cc
@@ -463,10 +463,32 @@ void report_t::entry_report(const entry_t& entry, const string& format)
{
}
+value_t report_t::get_amount_expr(call_scope_t& scope)
+{
+ return amount_expr.calc(scope);
+}
+
+value_t report_t::get_total_expr(call_scope_t& scope)
+{
+ return total_expr.calc(scope);
+}
+
expr_t::ptr_op_t report_t::lookup(const string& name)
{
const char * p = name.c_str();
switch (*p) {
+ case 'f':
+ if (std::strncmp(p, "fmt_", 4) == 0) {
+ p = p + 4;
+ switch (*p) {
+ case 't':
+ return MAKE_FUNCTOR(report_t::get_amount_expr);
+ case 'T':
+ return MAKE_FUNCTOR(report_t::get_total_expr);
+ }
+ }
+ break;
+
case 'o':
if (std::strncmp(p, "opt_", 4) == 0) {
p = p + 4;
diff --git a/report.h b/report.h
index b160c15b..6bcd8e88 100644
--- a/report.h
+++ b/report.h
@@ -238,9 +238,8 @@ public:
// Formatting functions
//
- value_t get_amount_expr(call_scope_t&) {
- return NULL_VALUE;
- }
+ value_t get_amount_expr(call_scope_t& scope);
+ value_t get_total_expr(call_scope_t& scope);
//
// Scope members
diff --git a/xact.cc b/xact.cc
index d9886752..02dc1842 100644
--- a/xact.cc
+++ b/xact.cc
@@ -86,6 +86,13 @@ namespace {
return xact.amount;
}
+ value_t get_total(xact_t& xact) {
+ if (xact.xdata_)
+ return xact.xdata_->total;
+ else
+ return xact.amount;
+ }
+
value_t get_cost(xact_t& xact) {
return xact.cost ? *xact.cost : xact.amount;
}
@@ -134,15 +141,6 @@ namespace {
return long(xact.end_line);
}
- // xdata_t members...
-
- value_t get_total(xact_t& xact) {
- if (xact.xdata_)
- return xact.xdata_->total;
- else
- return xact.amount;
- }
-
template <value_t (*Func)(xact_t&)>
value_t get_wrapper(call_scope_t& scope) {
return (*Func)(find_scope<xact_t>(scope));
@@ -187,6 +185,13 @@ expr_t::ptr_op_t xact_t::lookup(const string& name)
case 'p':
if (name == "pending")
return expr_t::op_t::wrap_value(2L);
+ else if (name == "payee")
+ return WRAP_FUNCTOR(get_wrapper<&get_payee>);
+ break;
+
+ case 't':
+ if (name[1] == '\0' || name == "total")
+ return WRAP_FUNCTOR(get_wrapper<&get_total>);
break;
case 'u':