Got pre-compiled headers working again, which are used if --devel is passed to

acprep.
This commit is contained in:
John Wiegley 2008-08-03 22:30:43 -04:00
parent bbdab79302
commit 8a21391d0a
7 changed files with 47 additions and 17 deletions

1
.gitignore vendored
View file

@ -40,6 +40,7 @@
/missing
/pending
/stamp-h1
/system.hh.gch
/texinfo.tex
AUTHORS
INSTALL

View file

@ -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) \

5
acprep
View file

@ -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

5
myacprep Executable file
View file

@ -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

View file

@ -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;

View file

@ -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

23
xact.cc
View file

@ -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':