summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-25 00:05:22 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-25 00:05:22 -0500
commit98ea23cd59cf959f3561632cc38043ab2d89f164 (patch)
tree18157b0191c83dcec9042c5ebfb4a70e48893169
parentf01fa1a5131c287a4efe2708ffe3c9bc57b79468 (diff)
parentf81b563339598a6075fa5c9ec6cb61bbffc9ba38 (diff)
downloadfork-ledger-98ea23cd59cf959f3561632cc38043ab2d89f164.tar.gz
fork-ledger-98ea23cd59cf959f3561632cc38043ab2d89f164.tar.bz2
fork-ledger-98ea23cd59cf959f3561632cc38043ab2d89f164.zip
Merge branch 'next'
-rwxr-xr-xacprep143
-rw-r--r--lib/Makefile108
-rw-r--r--src/commodity.h2
-rw-r--r--src/filters.cc14
-rw-r--r--src/item.cc6
-rw-r--r--src/pool.cc2
-rw-r--r--src/pool.h2
-rw-r--r--src/report.cc2
-rw-r--r--src/report.h5
-rw-r--r--src/scope.cc24
-rw-r--r--src/scope.h2
-rw-r--r--test/baseline/opt-pricedb-format.test2
-rw-r--r--test/baseline/opt-prices-format.test2
-rw-r--r--test/regress/D943AE0F.test2
-rw-r--r--tools/Makefile.am2
15 files changed, 161 insertions, 157 deletions
diff --git a/acprep b/acprep
index bfb3173a..20be2db4 100755
--- a/acprep
+++ b/acprep
@@ -188,7 +188,7 @@ class PrepareBuild(CommandLineApp):
self.sys_library_dirs = []
self.CPPFLAGS = []
- self.CCFLAGS = []
+ self.CFLAGS = []
self.CXXFLAGS = []
self.LDFLAGS = []
@@ -200,7 +200,7 @@ class PrepareBuild(CommandLineApp):
'LEDGER_PRODUCTS': None,
'CC': 'gcc',
'CPPFLAGS': '',
- 'CCFLAGS': '',
+ 'CFLAGS': '',
'CXX': 'g++',
'CXXFLAGS': '',
'LD': 'g++',
@@ -554,7 +554,7 @@ class PrepareBuild(CommandLineApp):
'automake',
'autoconf',
'libtool',
- 'python26',
+ 'python26', '+universal',
'libiconv', '+universal',
'zlib', '+universal',
'gmp' ,'+universal',
@@ -564,8 +564,8 @@ class PrepareBuild(CommandLineApp):
'gettext' ,'+universal',
'libedit' ,'+universal',
'boost-jam',
- 'boost', '+st+python26+icu',
- 'cppunit',
+ 'boost', '+icu+python26+st+universal',
+ 'cppunit', '+universal',
#'texlive',
#'doxygen',
#'graphviz',
@@ -605,7 +605,7 @@ class PrepareBuild(CommandLineApp):
'libboost1.40-dev',
'libboost-regex1.40-dev',
'libboost-date-time1.40-dev',
- 'libboost-filesystem1.40-dev'
+ 'libboost-filesystem1.40-dev',
'libboost-python1.40-dev',
'libedit-dev',
'libcppunit-dev',
@@ -636,7 +636,7 @@ class PrepareBuild(CommandLineApp):
'libboost-python1.35-dev',
'libboost-regex1.35-dev',
'libboost-date-time1.35-dev',
- 'libboost-filesystem1.35-dev'
+ 'libboost-filesystem1.35-dev',
'libedit-dev',
'libcppunit-dev',
#'texlive-full',
@@ -654,16 +654,29 @@ class PrepareBuild(CommandLineApp):
if release.readline().startswith('CentOS'):
self.log.info('Looks like you are using YUM on CentOS')
packages = [
- 'sudo', 'yum', 'install', 'gcc', 'gcc-c++',
- 'compat-gcc-*', 'make', 'libtool', 'autoconf',
- 'automake', 'zlib-devel', 'bzip2-devel',
- 'python-devel', 'bboost-devel',
- 'gmp-devel', 'gettext-devel',
- #'mpfr-devel'
- 'libedit-devel', 'cppunit-devel',
- #'texlive-full',
- #'doxygen', 'graphviz', 'texinfo',
- #'lcov', 'sloccount'
+ 'sudo', 'yum', 'install',
+ 'gcc',
+ 'gcc-c++',
+ 'compat-gcc-*',
+ 'make',
+ 'libtool',
+ 'autoconf',
+ 'automake',
+ 'zlib-devel',
+ 'bzip2-devel',
+ 'python-devel',
+ 'bboost-devel',
+ 'gmp-devel',
+ 'gettext-devel',
+ #'mpfr-devel'
+ 'libedit-devel',
+ 'cppunit-devel',
+ #'texlive-full',
+ #'doxygen',
+ #'graphviz',
+ 'texinfo',
+ #'lcov',
+ #'sloccount'
]
self.log.info('Executing: ' + string.join(packages, ' '))
self.execute(*packages)
@@ -676,15 +689,15 @@ class PrepareBuild(CommandLineApp):
environ, conf_args = self.configure_environment()
- boost = 'boost_1_40_0'
- tarball = boost + '.tar.bz2'
+ boost = 'boost_1_41_0'
+ tarball = boost + '.7z'
if not exists(boost):
if not exists(tarball):
self.log.info('Downloading Boost source tarball ...')
self.execute('curl', '-L', '-o', tarball,
'http://downloads.sourceforge.net/boost/' +
- boost + '.tar.bz2?use_mirror=ufpr')
+ boost + '.7z?use_mirror=ufpr')
if not exists(tarball):
self.log.error('Failed to locate the Boost source tarball')
@@ -699,12 +712,12 @@ class PrepareBuild(CommandLineApp):
fd.close()
digest = csum.hexdigest()
- if digest != 'a17281fd88c48e0d866e1a12deecbcc0':
+ if digest != 'b74ee2f0f46cef601544dd4ac2d7dec4':
self.log.error('Boost source tarball fails to match checksum')
sys.exit(1)
self.log.info('Extracting Boost source tarball ...')
- self.execute('tar', 'xjf', tarball)
+ self.execute('7za', 'x', tarball)
if not exists(boost):
self.log.error('Failed to locate the Boost sources')
@@ -804,7 +817,7 @@ class PrepareBuild(CommandLineApp):
self.sys_library_dirs.append(path)
def setup_for_johnw(self):
- if self.current_flavor != 'opt':
+ if self.current_flavor == 'debug' or self.current_flavor == 'gcov':
if exists('/usr/local/stow/cppunit/include'):
self.sys_include_dirs.insert(0, '/usr/local/stow/cppunit/include')
self.sys_library_dirs.insert(0, '/usr/local/stow/cppunit/lib')
@@ -814,13 +827,13 @@ class PrepareBuild(CommandLineApp):
self.sys_library_dirs.insert(0, '/usr/local/stow/icu/lib')
self.CPPFLAGS.append('-D_GLIBCXX_FULLY_DYNAMIC_STRING=1')
+ self.configure_args.append('--disable-shared')
self.options.use_glibcxx_debug = True
+ else:
+ self.CXXFLAGS.append('-march=nocona')
+ self.CXXFLAGS.append('-msse3')
- self.CXXFLAGS.append('-march=nocona')
- self.CXXFLAGS.append('-msse3')
-
- self.configure_args.append('--disable-shared')
self.configure_args.append('--enable-doxygen')
self.configure_args.append('--enable-python')
@@ -853,7 +866,8 @@ class PrepareBuild(CommandLineApp):
self.locate_darwin_libraries()
- if self.current_flavor == 'opt' and \
+ if (self.current_flavor == 'opt' or \
+ self.current_flavor == 'default') and \
exists('/usr/bin/g++-4.2'):
self.envvars['CC'] = '/usr/bin/gcc-4.2'
self.envvars['CXX'] = '/usr/bin/g++-4.2'
@@ -912,7 +926,7 @@ class PrepareBuild(CommandLineApp):
def finalize_config(self):
self.setup_flavor()
- for var in ('CPPFLAGS', 'CCFLAGS', 'CXXFLAGS', 'LDFLAGS'):
+ for var in ('CPPFLAGS', 'CFLAGS', 'CXXFLAGS', 'LDFLAGS'):
value = self.__dict__[var]
if value:
first = not self.envvars[var]
@@ -1031,39 +1045,23 @@ class PrepareBuild(CommandLineApp):
#########################################################################
def locate_darwin_libraries(self):
- if self.current_flavor != 'opt':
+ if self.current_flavor == 'debug' or self.current_flavor == 'gcov':
self.log.debug('We are using GLIBCXX_DEBUG, so setting up flags')
if self.options.use_glibcxx_debug:
self.CPPFLAGS.append('-D_GLIBCXX_DEBUG=1')
- if exists('/usr/local/stow/cppunit-debug/include'):
- if '/usr/local/stow/cppunit/include' in self.sys_include_dirs:
- self.sys_include_dirs.remove('/usr/local/stow/cppunit/include')
- self.sys_library_dirs.remove('/usr/local/stow/cppunit/lib')
-
- self.sys_include_dirs.insert(0, '/usr/local/stow/cppunit-debug/include')
- self.sys_library_dirs.insert(0, '/usr/local/stow/cppunit-debug/lib')
-
- if exists('/usr/local/stow/icu-debug/include'):
- if '/usr/local/stow/icu/include' in self.sys_include_dirs:
- self.sys_include_dirs.remove('/usr/local/stow/icu/include')
- self.sys_library_dirs.remove('/usr/local/stow/icu/lib')
-
- self.sys_include_dirs.insert(0, '/usr/local/stow/icu-debug/include')
- self.sys_library_dirs.insert(0, '/usr/local/stow/icu-debug/lib')
-
- if exists('/usr/local/lib/libboost_regex-xgcc44-sd-1_40.a'):
+ if exists('/usr/local/lib/libboost_regex-xgcc44-sd-1_41.a'):
self.envvars['BOOST_HOME'] = '/usr/local'
- self.envvars['BOOST_SUFFIX'] = '-xgcc44-sd-1_40'
- self.sys_include_dirs.append('/usr/local/include/boost-1_40')
+ self.envvars['BOOST_SUFFIX'] = '-xgcc44-sd-1_41'
+ self.sys_include_dirs.append('/usr/local/include/boost-1_41')
self.inform_boost_location('is really located',
self.envvars['BOOST_SUFFIX'])
- elif exists('/usr/local/lib/libboost_regex-xgcc44-d-1_40.a'):
+ elif exists('/usr/local/lib/libboost_regex-xgcc44-d-1_41.a'):
self.envvars['BOOST_HOME'] = '/usr/local'
- self.envvars['BOOST_SUFFIX'] = '-xgcc44-d-1_40'
- self.sys_include_dirs.append('/usr/local/include/boost-1_40')
+ self.envvars['BOOST_SUFFIX'] = '-xgcc44-d-1_41'
+ self.sys_include_dirs.append('/usr/local/include/boost-1_41')
self.inform_boost_location('is really located',
self.envvars['BOOST_SUFFIX'])
@@ -1082,17 +1080,17 @@ class PrepareBuild(CommandLineApp):
self.inform_boost_location('is really located',
self.envvars['BOOST_SUFFIX'])
- elif exists('/usr/local/lib/libboost_regex-xgcc44-s-1_40.a'):
+ elif exists('/usr/local/lib/libboost_regex-xgcc44-s-1_41.a'):
self.envvars['BOOST_HOME'] = '/usr/local'
- self.envvars['BOOST_SUFFIX'] = '-xgcc44-s-1_40'
- self.sys_include_dirs.append('/usr/local/include/boost-1_40')
+ self.envvars['BOOST_SUFFIX'] = '-xgcc44-s-1_41'
+ self.sys_include_dirs.append('/usr/local/include/boost-1_41')
self.inform_boost_location('is really located',
self.envvars['BOOST_SUFFIX'])
- elif exists('/usr/local/lib/libboost_regex-xgcc44-1_40.a'):
+ elif exists('/usr/local/lib/libboost_regex-xgcc44-1_41.a'):
self.envvars['BOOST_HOME'] = '/usr/local'
- self.envvars['BOOST_SUFFIX'] = '-xgcc44-1_40'
- self.sys_include_dirs.append('/usr/local/include/boost-1_40')
+ self.envvars['BOOST_SUFFIX'] = '-xgcc44-1_41'
+ self.sys_include_dirs.append('/usr/local/include/boost-1_41')
self.inform_boost_location('is really located',
self.envvars['BOOST_SUFFIX'])
@@ -1107,13 +1105,23 @@ class PrepareBuild(CommandLineApp):
def setup_flavor_opt(self):
if self.darwin_gcc:
- self.CXXFLAGS.append('-fast')
- self.LDFLAGS.append('-fast')
+ self.option_no_pch()
+ if '--disable-shared' in self.configure_args:
+ self.configure_args.remove('--disable-shared')
+ self.configure_args.append('--disable-dependency-tracking')
+ for i in ['-fast']:
+ self.CXXFLAGS.append(i)
+ self.CFLAGS.append(i)
+ self.LDFLAGS.append(i)
+ for i in ['-arch', 'i386', '-arch', 'x86_64']:
+ self.CXXFLAGS.append(i)
+ self.CFLAGS.append(i)
+ self.LDFLAGS.append(i)
else:
- self.CXXFLAGS.append('-O3')
- self.LDFLAGS.append('-O3')
- self.CXXFLAGS.append('-fomit-frame-pointer')
- self.LDFLAGS.append('-fomit-frame-pointer')
+ for i in ['-O3', '-fomit-frame-pointer']:
+ self.CXXFLAGS.append(i)
+ self.CFLAGS.append(i)
+ self.LDFLAGS.append(i)
def setup_flavor_gcov(self):
self.CXXFLAGS.append('-g')
@@ -1180,7 +1188,7 @@ class PrepareBuild(CommandLineApp):
conf_args = ['sh', join(self.source_dir, 'configure'),
'--srcdir', self.source_dir]
- for var in ('CC', 'CPPFLAGS', 'CCFLAGS', 'CXX', 'CXXFLAGS',
+ for var in ('CC', 'CPPFLAGS', 'CFLAGS', 'CXX', 'CXXFLAGS',
'LD', 'LDFLAGS'):
if self.envvars.has_key(var) and self.envvars[var] and \
(var.endswith('FLAGS') or exists(self.envvars[var])):
@@ -1237,6 +1245,11 @@ class PrepareBuild(CommandLineApp):
if not self.options.no_patch:
self.phase_patch()
+
+ # Wipe the pre-compiled header, if there is one
+ pch = join(self.build_directory(), 'system.hh.gch')
+ if exists(pch):
+ os.remove(pch)
else:
if not self.options.no_patch and \
self.isnewer('Makefile', '.timestamp'):
diff --git a/lib/Makefile b/lib/Makefile
index 608be7d5..7714f21d 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -2,96 +2,58 @@
# This is only important if you intend to produce a Ledger binary for
# installation.
-STOW_ROOT = /usr/local/stow
-PRODUCTS = $(HOME)/Products
-
-EXTRA_DEFINES = -D_GLIBCXX_FULLY_DYNAMIC_STRING=1
-
-BOOST_SOURCE = boost
-BOOST_VERSION = 1_40_0
+STOW_ROOT = /usr/local/stow
+PRODUCTS = $(HOME)/Products
+
+CC = gcc-mp-4.4
+CXX = g++-mp-4.4
+LD = gcc-mp-4.4
+CPPFLAGS = -D_GLIBCXX_DEBUG=1 -D_GLIBCXX_FULLY_DYNAMIC_STRING=1
+CFLAGS = $(CPPFLAGS) -g
+LDFLAGS = -g
+
+BOOST_VERSION = 1_41_0
+BOOST_SOURCE = boost_$(BOOST_VERSION)
BOOST_TOOLSET = darwin
-BOOST_DEFINES = define=_GLIBCXX_FULLY_DYNAMIC_STRING=1
+BOOST_DEFINES = define=_GLIBCXX_DEBUG=1 define=_GLIBCXX_FULLY_DYNAMIC_STRING=1
+#BOOST_FLAGS = --architecture=x86 --address_model=32_64
BOOST_FLAGS = --toolset=$(BOOST_TOOLSET) \
--build-type=complete --layout=versioned \
$(BOOST_DEFINES)
-ICU_FLAGS = -sHAVE_ICU=1 -sICU_PATH=$(STOW_ROOT)/icu
-ICU_DBG_FLAGS = -sHAVE_ICU=1 -sICU_PATH=$(STOW_ROOT)/icu-debug
+ICU_FLAGS = -sHAVE_ICU=1 -sICU_PATH=$(STOW_ROOT)/icu
-icu-release:
- -(cd icu/source; make distclean)
- (cd icu/source; sh autogen.sh; \
- ./configure CPPFLAGS="$(EXTRA_DEFINES)" \
- CFLAGS="$(EXTRA_DEFINES) $(ARCH_CFLAGS)" \
- LDFLAGS="$(ARCH_LDFLAGS)" \
- CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \
- --enable-static \
- --prefix=$(STOW_ROOT)/icu && \
- make install)
+all: boost-build cppunit-build icu-build boost-icu-build
-icu-debug:
- -(cd icu/source; make distclean)
- (cd icu/source; sh autogen.sh; \
- ./configure CPPFLAGS="-D_GLIBCXX_DEBUG=1 $(EXTRA_DEFINES)" \
- CFLAGS="-g $(EXTRA_DEFINES) $(ARCH_CFLAGS)" \
- LDFLAGS="-g $(ARCH_LDFLAGS)" \
- CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \
- --enable-static --enable-debug \
- --prefix=$(STOW_ROOT)/icu-debug && \
- make install)
-
-icu-build: icu-release icu-debug
-
-boost-icu-release:
- (cd $(BOOST_SOURCE) && \
- bjam release --prefix=$(STOW_ROOT)/boost_$(BOOST_VERSION)-icu \
- --build-dir=$(PRODUCTS)/boost_$(BOOST_VERSION)-icu \
- $(BOOST_FLAGS) $(ICU_FLAGS) install)
-
-boost-icu-debug:
- (cd $(BOOST_SOURCE) && \
- bjam debug --prefix=$(STOW_ROOT)/boost_$(BOOST_VERSION)-icu \
- --build-dir=$(PRODUCTS)/boost_$(BOOST_VERSION)-icu \
- $(BOOST_FLAGS) define=_GLIBCXX_DEBUG=1 \
- $(ICU_DBG_FLAGS) install)
-
-boost-icu-build: boost-icu-release boost-icu-debug
-
-boost-release:
- (cd $(BOOST_SOURCE) && \
- bjam release --prefix=$(STOW_ROOT)/boost_$(BOOST_VERSION) \
- --build-dir=$(PRODUCTS)/boost_$(BOOST_VERSION) \
- $(BOOST_FLAGS) install)
-
-boost-debug:
+boost-build:
(cd $(BOOST_SOURCE) && \
bjam debug --prefix=$(STOW_ROOT)/boost_$(BOOST_VERSION) \
--build-dir=$(PRODUCTS)/boost_$(BOOST_VERSION) \
- $(BOOST_FLAGS) define=_GLIBCXX_DEBUG=1 install)
-
-boost-build: boost-release boost-debug
+ $(BOOST_FLAGS) install)
-cppunit-release:
+cppunit-build:
-(cd cppunit; make distclean)
(cd cppunit; sh autogen.sh; \
- ./configure CPPFLAGS="$(EXTRA_DEFINES)" \
- CFLAGS="$(EXTRA_DEFINES) $(ARCH_CFLAGS)" \
- LDFLAGS="$(ARCH_LDFLAGS)" \
+ ./configure CPPFLAGS="$(CPPFLAGS)" \
+ CFLAGS="$(CFLAGS)" \
+ LDFLAGS="$(LDFLAGS)" \
CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \
--prefix=$(STOW_ROOT)/cppunit \
--disable-doxygen --disable-dot && \
make install)
-cppunit-debug:
- -(cd cppunit; make distclean)
- (cd cppunit; sh autogen.sh; \
- ./configure CPPFLAGS="-D_GLIBCXX_DEBUG=1 $(EXTRA_DEFINES)" \
- CFLAGS="-g $(EXTRA_DEFINES) $(ARCH_CFLAGS)" \
- LDFLAGS="-g $(ARCH_LDFLAGS)" \
+icu-build:
+ -(cd icu/source; make distclean)
+ (cd icu/source; sh autogen.sh; \
+ ./configure CPPFLAGS="$(CPPFLAGS)" \
+ CFLAGS="$(CFLAGS)" \
+ LDFLAGS="$(LDFLAGS)" \
CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \
- --prefix=$(STOW_ROOT)/cppunit-debug \
- --disable-doxygen --disable-dot && \
+ --enable-static --enable-debug \
+ --prefix=$(STOW_ROOT)/icu && \
make install)
-cppunit-build: cppunit-release cppunit-debug
-
-all: boost-build boost-icu-build cppunit-build
+boost-icu-build:
+ (cd $(BOOST_SOURCE) && \
+ bjam debug --prefix=$(STOW_ROOT)/boost_$(BOOST_VERSION)-icu \
+ --build-dir=$(PRODUCTS)/boost_$(BOOST_VERSION)-icu \
+ $(BOOST_FLAGS) $(ICU_FLAGS) install)
diff --git a/src/commodity.h b/src/commodity.h
index d5f18844..3370f3f2 100644
--- a/src/commodity.h
+++ b/src/commodity.h
@@ -185,7 +185,7 @@ protected:
symbol(_symbol), precision(0), searched(false) {
TRACE_CTOR(base_t, "const string&");
}
- ~base_t() {
+ virtual ~base_t() {
TRACE_DTOR(base_t);
}
diff --git a/src/filters.cc b/src/filters.cc
index 39097c58..0084fac7 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -430,12 +430,22 @@ changed_value_posts::changed_value_posts(post_handler_ptr handler,
display_total_expr = report.HANDLER(display_total_).expr;
changed_values_only = report.HANDLED(revalued_only);
+ string gains_equity_account_name;
+ if (report.HANDLED(unrealized_gains_))
+ gains_equity_account_name = report.HANDLER(unrealized_gains_).str();
+ else
+ gains_equity_account_name = _("Equity:Unrealized Gains");
gains_equity_account =
- report.session.journal->master->find_account(_("Equity:Unrealized Gains"));
+ report.session.journal->master->find_account(gains_equity_account_name);
gains_equity_account->add_flags(ACCOUNT_GENERATED);
+ string losses_equity_account_name;
+ if (report.HANDLED(unrealized_losses_))
+ losses_equity_account_name = report.HANDLER(unrealized_losses_).str();
+ else
+ losses_equity_account_name = _("Equity:Unrealized Losses");
losses_equity_account =
- report.session.journal->master->find_account(_("Equity:Unrealized Losses"));
+ report.session.journal->master->find_account(losses_equity_account_name);
losses_equity_account->add_flags(ACCOUNT_GENERATED);
}
diff --git a/src/item.cc b/src/item.cc
index da6429ed..99d1d835 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -115,7 +115,8 @@ void item_t::set_tag(const string& tag,
assert(result.second);
}
-void item_t::parse_tags(const char * p, optional<date_t::year_type> current_year)
+void item_t::parse_tags(const char * p,
+ optional<date_t::year_type> current_year)
{
if (const char * b = std::strchr(p, '[')) {
if (*(b + 1) != '\0' &&
@@ -164,7 +165,8 @@ void item_t::parse_tags(const char * p, optional<date_t::year_type> current_year
}
}
-void item_t::append_note(const char * p, optional<date_t::year_type> current_year)
+void item_t::append_note(const char * p,
+ optional<date_t::year_type> current_year)
{
if (note) {
*note += '\n';
diff --git a/src/pool.cc b/src/pool.cc
index 9e06613f..00f4a3da 100644
--- a/src/pool.cc
+++ b/src/pool.cc
@@ -316,7 +316,7 @@ optional<price_point_t> commodity_pool_t::parse_price_directive(char * line)
price_point_t point;
point.when = datetime;
- point.price.parse(symbol_and_price);
+ point.price.parse(symbol_and_price, PARSE_NO_MIGRATE);
VERIFY(point.price.valid());
DEBUG("commodity.download", "Looking up symbol: " << symbol);
diff --git a/src/pool.h b/src/pool.h
index c3d701b9..85de73a9 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -84,7 +84,7 @@ public:
explicit commodity_pool_t();
- ~commodity_pool_t() {
+ virtual ~commodity_pool_t() {
TRACE_DTOR(commodity_pool_t);
foreach (commodities_map::value_type pair, commodities)
checked_delete(pair.second);
diff --git a/src/report.cc b/src/report.cc
index 4c157312..894e0d89 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -887,6 +887,8 @@ option_t<report_t> * report_t::lookup_option(const char * p)
OPT(unbudgeted);
else OPT(uncleared);
else OPT(unrealized);
+ else OPT(unrealized_gains_);
+ else OPT(unrealized_losses_);
else OPT(unround);
else OPT(unsorted);
break;
diff --git a/src/report.h b/src/report.h
index 354e31b6..d942038b 100644
--- a/src/report.h
+++ b/src/report.h
@@ -302,6 +302,8 @@ public:
HANDLER(unbudgeted).report(out);
HANDLER(uncleared).report(out);
HANDLER(unrealized).report(out);
+ HANDLER(unrealized_gains_).report(out);
+ HANDLER(unrealized_losses_).report(out);
HANDLER(unround).report(out);
HANDLER(unsorted).report(out);
HANDLER(weekly).report(out);
@@ -876,6 +878,9 @@ public:
OPTION(report_t, unrealized);
+ OPTION(report_t, unrealized_gains_);
+ OPTION(report_t, unrealized_losses_);
+
OPTION_(report_t, unround, DO() {
parent->HANDLER(display_amount_)
.set_expr(string("--unround"), "unrounded(amount_expr)");
diff --git a/src/scope.cc b/src/scope.cc
index 99f6b669..64736ca3 100644
--- a/src/scope.cc
+++ b/src/scope.cc
@@ -42,15 +42,18 @@ void symbol_scope_t::define(const symbol_t::kind_t kind,
{
DEBUG("scope.symbols", "Defining '" << name << "' = " << def);
+ if (! symbols)
+ symbols = symbol_map();
+
std::pair<symbol_map::iterator, bool> result
- = symbols.insert(symbol_map::value_type(symbol_t(kind, name, def), def));
+ = symbols->insert(symbol_map::value_type(symbol_t(kind, name, def), def));
if (! result.second) {
- symbol_map::iterator i = symbols.find(symbol_t(kind, name));
- assert(i != symbols.end());
- symbols.erase(i);
+ symbol_map::iterator i = symbols->find(symbol_t(kind, name));
+ assert(i != symbols->end());
+ symbols->erase(i);
- result = symbols.insert(symbol_map::value_type(symbol_t(kind, name, def),
- def));
+ result = symbols->insert(symbol_map::value_type(symbol_t(kind, name, def),
+ def));
if (! result.second)
throw_(compile_error,
_("Redefinition of '%1' in the same scope") << name);
@@ -60,10 +63,11 @@ void symbol_scope_t::define(const symbol_t::kind_t kind,
expr_t::ptr_op_t symbol_scope_t::lookup(const symbol_t::kind_t kind,
const string& name)
{
- symbol_map::const_iterator i = symbols.find(symbol_t(kind, name));
- if (i != symbols.end())
- return (*i).second;
-
+ if (symbols) {
+ symbol_map::const_iterator i = symbols->find(symbol_t(kind, name));
+ if (i != symbols->end())
+ return (*i).second;
+ }
return child_scope_t::lookup(kind, name);
}
diff --git a/src/scope.h b/src/scope.h
index 44ca3229..93f80230 100644
--- a/src/scope.h
+++ b/src/scope.h
@@ -172,7 +172,7 @@ class symbol_scope_t : public child_scope_t
{
typedef std::map<symbol_t, expr_t::ptr_op_t> symbol_map;
- symbol_map symbols;
+ optional<symbol_map> symbols;
public:
explicit symbol_scope_t() {
diff --git a/test/baseline/opt-pricedb-format.test b/test/baseline/opt-pricedb-format.test
index 5dbff609..e2c26f5f 100644
--- a/test/baseline/opt-pricedb-format.test
+++ b/test/baseline/opt-pricedb-format.test
@@ -1,5 +1,7 @@
pricedb --pricedb-format='P %(date) %(scrub(display_amount))\n'
<<<
+D $1,000.00
+
P 2009/01/01 13:30:00 AAPL $10.00
P 2009/01/01 14:30:00 AAPL $20.00
P 2009/01/01 15:30:00 AAPL $30.00
diff --git a/test/baseline/opt-prices-format.test b/test/baseline/opt-prices-format.test
index f8033c59..8a83ad5f 100644
--- a/test/baseline/opt-prices-format.test
+++ b/test/baseline/opt-prices-format.test
@@ -1,5 +1,7 @@
prices --prices-format='%(datetime) %(scrub(display_amount))\n'
<<<
+D $1,000.00
+
P 2009/01/01 13:30:00 AAPL $10.00
P 2009/01/01 14:30:00 AAPL $20.00
P 2009/01/01 15:30:00 AAPL $30.00
diff --git a/test/regress/D943AE0F.test b/test/regress/D943AE0F.test
index 3e568db6..94a26df5 100644
--- a/test/regress/D943AE0F.test
+++ b/test/regress/D943AE0F.test
@@ -1,5 +1,7 @@
reg -V --end=2009/06/16
<<<
+D 1000.00 EUR
+
2008/04/15 * Paid expenses back from cie.
Expenses:Cie-Reimbursements 2000 CAD @ 1.10 EUR
Assets:Checking
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 9821bf4c..09daafe6 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -232,7 +232,7 @@ ledger_la_CPPFLAGS = $(libledger_python_la_CPPFLAGS)
ledger_la_SOURCES = src/pyledger.cc
ledger_la_DEPENDENCIES = $(lib_LTLIBRARIES)
ledger_la_LDFLAGS = -avoid-version -module
-ledger_la_LIBADD = $(LIBOBJS) $(lib_LTLIBRARIES) $(INTLLIBS)
+ledger_la_LIBADD = $(LIBOBJS) $(lib_LTLIBRARIES)
pkgpython_PYTHON = python/__init__.py python/server.py