diff options
-rw-r--r-- | Makefile.am | 61 | ||||
-rwxr-xr-x | acprep | 13 | ||||
-rwxr-xr-x | setup.py | 3 | ||||
-rw-r--r-- | textual.cc | 51 |
4 files changed, 51 insertions, 77 deletions
diff --git a/Makefile.am b/Makefile.am index 239ade37..6fac1788 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,6 +20,15 @@ libamounts_la_SOURCES = \ value.cc \ times.cc \ utils.cc +if HAVE_EXPAT +libamounts_la_CPPFLAGS += -DHAVE_EXPAT=1 +endif +if HAVE_XMLPARSE +libamounts_la_CPPFLAGS += -DHAVE_XMLPARSE=1 +endif +if HAVE_LIBOFX +libamounts_la_CPPFLAGS += -DHAVE_LIBOFX=1 +endif if HAVE_BOOST_PYTHON libamounts_la_CPPFLAGS += -DUSE_BOOST_PYTHON=1 endif @@ -27,7 +36,7 @@ if DEBUG libamounts_la_CPPFLAGS += -DDEBUG_MODE endif -libledger_la_CPPFLAGS = +libledger_la_CPPFLAGS = $(libamounts_la_CPPFLAGS) libledger_la_SOURCES = \ binary.cc \ config.cc \ @@ -49,20 +58,15 @@ libledger_la_SOURCES = \ xml.cc # quotes.cc this is currently not being included if HAVE_EXPAT -libledger_la_CPPFLAGS += -DHAVE_EXPAT=1 libledger_la_SOURCES += gnucash.cc endif if HAVE_XMLPARSE -libledger_la_CPPFLAGS += -DHAVE_XMLPARSE=1 libledger_la_SOURCES += gnucash.cc endif if HAVE_LIBOFX -libledger_la_CPPFLAGS += -DHAVE_LIBOFX=1 libledger_la_SOURCES += ofx.cc endif -if DEBUG -libledger_la_CPPFLAGS += -DDEBUG_MODE -endif + libledger_la_LDFLAGS = -release 2.6.0.90 pkginclude_HEADERS = \ @@ -104,39 +108,28 @@ nodist_libledger_la_SOURCES = system.hh.gch BUILT_SOURCES += system.hh.gch CLEANFILES += system.hh.gch system.hh -$(top_builddir)/system.hh.gch: $(srcdir)/src/utility/system.hh acconf.h - echo "#include \"src/utility/system.hh\"" > $(top_builddir)/system.hh - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(libledger_la_CPPFLAGS) \ - -o $@ $(srcdir)/src/utility/system.hh +$(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) \ + -g -o $@ $(srcdir)/system.hh endif ###################################################################### -bin_PROGRAMS = ledger -ledger_CPPFLAGS = -ledger_SOURCES = main.cc -ledger_LDADD = $(LIBOBJS) libamounts.la libledger.la -if HAVE_EXPAT -ledger_CPPFLAGS += -DHAVE_EXPAT=1 -endif -if HAVE_XMLPARSE -ledger_CPPFLAGS += -DHAVE_XMLPARSE=1 -endif -if HAVE_LIBOFX -ledger_CPPFLAGS += -DHAVE_LIBOFX=1 -endif -if DEBUG -ledger_CPPFLAGS += -DDEBUG_MODE -endif -ledger_LDFLAGS = -static # for the sake of command-line speed +bin_PROGRAMS = ledger -info_TEXINFOS = ledger.texi +ledger_CPPFLAGS = $(libledger_la_CPPFLAGS) +ledger_SOURCES = main.cc +ledger_LDADD = $(LIBOBJS) libamounts.la libledger.la +ledger_LDFLAGS = -static # for the sake of command-line speed -###################################################################### +info_TEXINFOS = ledger.texi -dist_lisp_LISP = ledger.el timeclock.el +dist_lisp_LISP = ledger.el timeclock.el -DISTCLEANFILES = ledger.elc timeclock.elc +DISTCLEANFILES = ledger.elc timeclock.elc ###################################################################### @@ -152,13 +145,13 @@ clean-local: PYLIBS = amounts gmp amounts.so: amounts.cc libamounts.la - CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libamounts_la_CPPFLAGS)" \ + CFLAGS="$(CPPFLAGS) $(DEFAULT_INCLUDES) $(libamounts_la_CPPFLAGS)" \ LDFLAGS="$(LDFLAGS) -L. -L.libs" \ PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \ python $(srcdir)/setup.py build --build-lib=. install-exec-hook: - CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libamounts_la_CPPFLAGS)" \ + CFLAGS="$(CPPFLAGS) $(DEFAULT_INCLUDES) $(libamounts_la_CPPFLAGS)" \ LDFLAGS="$(LDFLAGS) -L. -L.libs" \ PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \ python $(srcdir)/setup.py install --prefix=$(prefix) @@ -57,7 +57,7 @@ LDFLAGS="$LIBDIRS" LOCAL=false # Warning flags -CXXFLAGS="$CXXFLAGS -Wall -ansi" +CXXFLAGS="$CXXFLAGS -Wall -ansi -Winvalid-pch" #CXXFLAGS="$CXXFLAGS -Wextra" #CXXFLAGS="$CXXFLAGS -Weffc++" #CXXFLAGS="$CXXFLAGS -Wcast-align" @@ -78,7 +78,10 @@ CXXFLAGS="$CXXFLAGS -Wall -ansi" while [ -n "$1" ]; do case "$1" in --devel) - SWITCHES="$SWITCHES --disable-shared --enable-pch" + #SWITCHES="$SWITCHES --disable-shared --enable-pch" + SWITCHES="$SWITCHES --disable-shared" + CPPFLAGS="$CPPFLAGS -DBOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING=1" + CPPFLAGS="$CPPFLAGS -DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE=1" ;; --debug) @@ -127,13 +130,15 @@ if [ "$LOCAL" = "false" -a -d "$HOME/Products" ]; then if [ -x version ]; then version="-$(./version)" fi - projdir="$HOME/Products/$(basename $HERE)$version" + projdir="$HOME/Products/$(basename $HERE)" + rm -fr ${projdir}* + projdir="$projdir$version" if [ ! -d "$projdir" ]; then mkdir -p "$projdir" fi cd "$projdir" || (echo "Cannot change to $projdir"; exit 1) fi -"$HERE/configure" --srcdir="$HERE" \ +"$HERE/configure" --srcdir="$HERE" CXX="$CXX" \ CPPFLAGS="$CPPFLAGS" CXXFLAGS="$CXXFLAGS $local_cxxflags" \ LDFLAGS="$LDFLAGS" LIBS="$LIBS" $SWITCHES "$@" @@ -15,6 +15,5 @@ setup(name = "Ledger", url = "http://www.newartisans.com/software/ledger.html", ext_modules = [ Extension("ledger", - [os.path.join(os.environ['SRCDIR'], - "src", "python", "pyledger.cc")], + [os.path.join(os.environ['SRCDIR'], "pyledger.cc")], define_macros = defines, libraries = libs)]) @@ -281,6 +281,8 @@ bool parse_transactions(std::istream& in, const string& kind, unsigned long beg_pos) { + TRACE_START(entry_xacts, 1, "Time spent parsing transactions:"); + static char line[MAX_LINE + 1]; bool added = false; @@ -302,29 +304,20 @@ bool parse_transactions(std::istream& in, } } - return added; -} + TRACE_STOP(entry_xacts, 1); -#if 0 -namespace { - TIMER_DEF(parsing_total, "total parsing time"); - TIMER_DEF(entry_xacts, "parsing transactions"); - TIMER_DEF(entry_details, "parsing entry details"); - TIMER_DEF(entry_date, "parsing entry date"); + return added; } -#endif entry_t * parse_entry(std::istream& in, char * line, account_t * master, textual_parser_t& parser, unsigned long& pos) { + TRACE_START(entry_text, 1, "Time spent preparing entry text:"); + std::auto_ptr<entry_t> curr(new entry_t); // Parse the date -#if 0 - TIMER_START(entry_date); -#endif - char * next = next_element(line); if (char * p = std::strchr(line, '=')) { @@ -333,16 +326,8 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master, } curr->_date = parse_datetime(line); -#if 0 - TIMER_STOP(entry_date); -#endif - // Parse the optional cleared flag: * -#if 0 - TIMER_START(entry_details); -#endif - transaction_t::state_t state = transaction_t::UNCLEARED; if (next) { switch (*next) { @@ -371,15 +356,11 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master, curr->payee = next ? next : "<Unspecified payee>"; -#if 0 - TIMER_STOP(entry_details); -#endif + TRACE_STOP(entry_text, 1); // Parse all of the transactions associated with this entry -#if 0 - TIMER_START(entry_xacts); -#endif + TRACE_START(entry_details, 1, "Time spent parsing entry details:"); unsigned long end_pos; unsigned long beg_line = linenum; @@ -418,9 +399,7 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master, break; } -#if 0 - TIMER_STOP(entry_xacts); -#endif + TRACE_STOP(entry_details, 1); return curr.release(); } @@ -544,15 +523,13 @@ unsigned int textual_parser_t::parse(std::istream& in, account_t * master, const path * original_file) { + TRACE_START(parsing_total, 1, "Total time spent parsing text:"); + static bool added_auto_entry_hook = false; static char line[MAX_LINE + 1]; unsigned int count = 0; unsigned int errors = 0; -#if 0 - TIMER_START(parsing_total); -#endif - std::list<account_t *> account_stack; auto_entry_finalizer_t auto_entry_finalizer(journal); @@ -827,6 +804,7 @@ unsigned int textual_parser_t::parse(std::istream& in, default: { unsigned long pos = beg_pos; + TRACE_START(entries, 1, "Time spent handling entries:"); if (entry_t * entry = parse_entry(in, line, account_stack.front(), *this, pos)) { if (journal->add_entry(entry)) { @@ -844,6 +822,7 @@ unsigned int textual_parser_t::parse(std::istream& in, throw new parse_error("Failed to parse entry"); } end_pos = pos; + TRACE_STOP(entries, 1); break; } } @@ -882,9 +861,7 @@ unsigned int textual_parser_t::parse(std::istream& in, if (errors > 0) throw (int)errors; -#if 0 - TIMER_STOP(parsing_total); -#endif + TRACE_STOP(parsing_total, 1); return count; } |