Merge branch 'next'

This commit is contained in:
John Wiegley 2009-11-25 00:05:22 -05:00
commit 98ea23cd59
15 changed files with 161 additions and 157 deletions

135
acprep
View file

@ -188,7 +188,7 @@ class PrepareBuild(CommandLineApp):
self.sys_library_dirs = [] self.sys_library_dirs = []
self.CPPFLAGS = [] self.CPPFLAGS = []
self.CCFLAGS = [] self.CFLAGS = []
self.CXXFLAGS = [] self.CXXFLAGS = []
self.LDFLAGS = [] self.LDFLAGS = []
@ -200,7 +200,7 @@ class PrepareBuild(CommandLineApp):
'LEDGER_PRODUCTS': None, 'LEDGER_PRODUCTS': None,
'CC': 'gcc', 'CC': 'gcc',
'CPPFLAGS': '', 'CPPFLAGS': '',
'CCFLAGS': '', 'CFLAGS': '',
'CXX': 'g++', 'CXX': 'g++',
'CXXFLAGS': '', 'CXXFLAGS': '',
'LD': 'g++', 'LD': 'g++',
@ -554,7 +554,7 @@ class PrepareBuild(CommandLineApp):
'automake', 'automake',
'autoconf', 'autoconf',
'libtool', 'libtool',
'python26', 'python26', '+universal',
'libiconv', '+universal', 'libiconv', '+universal',
'zlib', '+universal', 'zlib', '+universal',
'gmp' ,'+universal', 'gmp' ,'+universal',
@ -564,8 +564,8 @@ class PrepareBuild(CommandLineApp):
'gettext' ,'+universal', 'gettext' ,'+universal',
'libedit' ,'+universal', 'libedit' ,'+universal',
'boost-jam', 'boost-jam',
'boost', '+st+python26+icu', 'boost', '+icu+python26+st+universal',
'cppunit', 'cppunit', '+universal',
#'texlive', #'texlive',
#'doxygen', #'doxygen',
#'graphviz', #'graphviz',
@ -605,7 +605,7 @@ class PrepareBuild(CommandLineApp):
'libboost1.40-dev', 'libboost1.40-dev',
'libboost-regex1.40-dev', 'libboost-regex1.40-dev',
'libboost-date-time1.40-dev', 'libboost-date-time1.40-dev',
'libboost-filesystem1.40-dev' 'libboost-filesystem1.40-dev',
'libboost-python1.40-dev', 'libboost-python1.40-dev',
'libedit-dev', 'libedit-dev',
'libcppunit-dev', 'libcppunit-dev',
@ -636,7 +636,7 @@ class PrepareBuild(CommandLineApp):
'libboost-python1.35-dev', 'libboost-python1.35-dev',
'libboost-regex1.35-dev', 'libboost-regex1.35-dev',
'libboost-date-time1.35-dev', 'libboost-date-time1.35-dev',
'libboost-filesystem1.35-dev' 'libboost-filesystem1.35-dev',
'libedit-dev', 'libedit-dev',
'libcppunit-dev', 'libcppunit-dev',
#'texlive-full', #'texlive-full',
@ -654,16 +654,29 @@ class PrepareBuild(CommandLineApp):
if release.readline().startswith('CentOS'): if release.readline().startswith('CentOS'):
self.log.info('Looks like you are using YUM on CentOS') self.log.info('Looks like you are using YUM on CentOS')
packages = [ packages = [
'sudo', 'yum', 'install', 'gcc', 'gcc-c++', 'sudo', 'yum', 'install',
'compat-gcc-*', 'make', 'libtool', 'autoconf', 'gcc',
'automake', 'zlib-devel', 'bzip2-devel', 'gcc-c++',
'python-devel', 'bboost-devel', 'compat-gcc-*',
'gmp-devel', 'gettext-devel', 'make',
'libtool',
'autoconf',
'automake',
'zlib-devel',
'bzip2-devel',
'python-devel',
'bboost-devel',
'gmp-devel',
'gettext-devel',
#'mpfr-devel' #'mpfr-devel'
'libedit-devel', 'cppunit-devel', 'libedit-devel',
'cppunit-devel',
#'texlive-full', #'texlive-full',
#'doxygen', 'graphviz', 'texinfo', #'doxygen',
#'lcov', 'sloccount' #'graphviz',
'texinfo',
#'lcov',
#'sloccount'
] ]
self.log.info('Executing: ' + string.join(packages, ' ')) self.log.info('Executing: ' + string.join(packages, ' '))
self.execute(*packages) self.execute(*packages)
@ -676,15 +689,15 @@ class PrepareBuild(CommandLineApp):
environ, conf_args = self.configure_environment() environ, conf_args = self.configure_environment()
boost = 'boost_1_40_0' boost = 'boost_1_41_0'
tarball = boost + '.tar.bz2' tarball = boost + '.7z'
if not exists(boost): if not exists(boost):
if not exists(tarball): if not exists(tarball):
self.log.info('Downloading Boost source tarball ...') self.log.info('Downloading Boost source tarball ...')
self.execute('curl', '-L', '-o', tarball, self.execute('curl', '-L', '-o', tarball,
'http://downloads.sourceforge.net/boost/' + 'http://downloads.sourceforge.net/boost/' +
boost + '.tar.bz2?use_mirror=ufpr') boost + '.7z?use_mirror=ufpr')
if not exists(tarball): if not exists(tarball):
self.log.error('Failed to locate the Boost source tarball') self.log.error('Failed to locate the Boost source tarball')
@ -699,12 +712,12 @@ class PrepareBuild(CommandLineApp):
fd.close() fd.close()
digest = csum.hexdigest() digest = csum.hexdigest()
if digest != 'a17281fd88c48e0d866e1a12deecbcc0': if digest != 'b74ee2f0f46cef601544dd4ac2d7dec4':
self.log.error('Boost source tarball fails to match checksum') self.log.error('Boost source tarball fails to match checksum')
sys.exit(1) sys.exit(1)
self.log.info('Extracting Boost source tarball ...') self.log.info('Extracting Boost source tarball ...')
self.execute('tar', 'xjf', tarball) self.execute('7za', 'x', tarball)
if not exists(boost): if not exists(boost):
self.log.error('Failed to locate the Boost sources') self.log.error('Failed to locate the Boost sources')
@ -804,7 +817,7 @@ class PrepareBuild(CommandLineApp):
self.sys_library_dirs.append(path) self.sys_library_dirs.append(path)
def setup_for_johnw(self): 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'): if exists('/usr/local/stow/cppunit/include'):
self.sys_include_dirs.insert(0, '/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') 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.sys_library_dirs.insert(0, '/usr/local/stow/icu/lib')
self.CPPFLAGS.append('-D_GLIBCXX_FULLY_DYNAMIC_STRING=1') self.CPPFLAGS.append('-D_GLIBCXX_FULLY_DYNAMIC_STRING=1')
self.configure_args.append('--disable-shared')
self.options.use_glibcxx_debug = True self.options.use_glibcxx_debug = True
else:
self.CXXFLAGS.append('-march=nocona') self.CXXFLAGS.append('-march=nocona')
self.CXXFLAGS.append('-msse3') self.CXXFLAGS.append('-msse3')
self.configure_args.append('--disable-shared')
self.configure_args.append('--enable-doxygen') self.configure_args.append('--enable-doxygen')
self.configure_args.append('--enable-python') self.configure_args.append('--enable-python')
@ -853,7 +866,8 @@ class PrepareBuild(CommandLineApp):
self.locate_darwin_libraries() 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'): exists('/usr/bin/g++-4.2'):
self.envvars['CC'] = '/usr/bin/gcc-4.2' self.envvars['CC'] = '/usr/bin/gcc-4.2'
self.envvars['CXX'] = '/usr/bin/g++-4.2' self.envvars['CXX'] = '/usr/bin/g++-4.2'
@ -912,7 +926,7 @@ class PrepareBuild(CommandLineApp):
def finalize_config(self): def finalize_config(self):
self.setup_flavor() self.setup_flavor()
for var in ('CPPFLAGS', 'CCFLAGS', 'CXXFLAGS', 'LDFLAGS'): for var in ('CPPFLAGS', 'CFLAGS', 'CXXFLAGS', 'LDFLAGS'):
value = self.__dict__[var] value = self.__dict__[var]
if value: if value:
first = not self.envvars[var] first = not self.envvars[var]
@ -1031,39 +1045,23 @@ class PrepareBuild(CommandLineApp):
######################################################################### #########################################################################
def locate_darwin_libraries(self): 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') self.log.debug('We are using GLIBCXX_DEBUG, so setting up flags')
if self.options.use_glibcxx_debug: if self.options.use_glibcxx_debug:
self.CPPFLAGS.append('-D_GLIBCXX_DEBUG=1') self.CPPFLAGS.append('-D_GLIBCXX_DEBUG=1')
if exists('/usr/local/stow/cppunit-debug/include'): if exists('/usr/local/lib/libboost_regex-xgcc44-sd-1_41.a'):
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'):
self.envvars['BOOST_HOME'] = '/usr/local' self.envvars['BOOST_HOME'] = '/usr/local'
self.envvars['BOOST_SUFFIX'] = '-xgcc44-sd-1_40' self.envvars['BOOST_SUFFIX'] = '-xgcc44-sd-1_41'
self.sys_include_dirs.append('/usr/local/include/boost-1_40') self.sys_include_dirs.append('/usr/local/include/boost-1_41')
self.inform_boost_location('is really located', self.inform_boost_location('is really located',
self.envvars['BOOST_SUFFIX']) 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_HOME'] = '/usr/local'
self.envvars['BOOST_SUFFIX'] = '-xgcc44-d-1_40' self.envvars['BOOST_SUFFIX'] = '-xgcc44-d-1_41'
self.sys_include_dirs.append('/usr/local/include/boost-1_40') self.sys_include_dirs.append('/usr/local/include/boost-1_41')
self.inform_boost_location('is really located', self.inform_boost_location('is really located',
self.envvars['BOOST_SUFFIX']) self.envvars['BOOST_SUFFIX'])
@ -1082,17 +1080,17 @@ class PrepareBuild(CommandLineApp):
self.inform_boost_location('is really located', self.inform_boost_location('is really located',
self.envvars['BOOST_SUFFIX']) 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_HOME'] = '/usr/local'
self.envvars['BOOST_SUFFIX'] = '-xgcc44-s-1_40' self.envvars['BOOST_SUFFIX'] = '-xgcc44-s-1_41'
self.sys_include_dirs.append('/usr/local/include/boost-1_40') self.sys_include_dirs.append('/usr/local/include/boost-1_41')
self.inform_boost_location('is really located', self.inform_boost_location('is really located',
self.envvars['BOOST_SUFFIX']) 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_HOME'] = '/usr/local'
self.envvars['BOOST_SUFFIX'] = '-xgcc44-1_40' self.envvars['BOOST_SUFFIX'] = '-xgcc44-1_41'
self.sys_include_dirs.append('/usr/local/include/boost-1_40') self.sys_include_dirs.append('/usr/local/include/boost-1_41')
self.inform_boost_location('is really located', self.inform_boost_location('is really located',
self.envvars['BOOST_SUFFIX']) self.envvars['BOOST_SUFFIX'])
@ -1107,13 +1105,23 @@ class PrepareBuild(CommandLineApp):
def setup_flavor_opt(self): def setup_flavor_opt(self):
if self.darwin_gcc: if self.darwin_gcc:
self.CXXFLAGS.append('-fast') self.option_no_pch()
self.LDFLAGS.append('-fast') 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: else:
self.CXXFLAGS.append('-O3') for i in ['-O3', '-fomit-frame-pointer']:
self.LDFLAGS.append('-O3') self.CXXFLAGS.append(i)
self.CXXFLAGS.append('-fomit-frame-pointer') self.CFLAGS.append(i)
self.LDFLAGS.append('-fomit-frame-pointer') self.LDFLAGS.append(i)
def setup_flavor_gcov(self): def setup_flavor_gcov(self):
self.CXXFLAGS.append('-g') self.CXXFLAGS.append('-g')
@ -1180,7 +1188,7 @@ class PrepareBuild(CommandLineApp):
conf_args = ['sh', join(self.source_dir, 'configure'), conf_args = ['sh', join(self.source_dir, 'configure'),
'--srcdir', self.source_dir] '--srcdir', self.source_dir]
for var in ('CC', 'CPPFLAGS', 'CCFLAGS', 'CXX', 'CXXFLAGS', for var in ('CC', 'CPPFLAGS', 'CFLAGS', 'CXX', 'CXXFLAGS',
'LD', 'LDFLAGS'): 'LD', 'LDFLAGS'):
if self.envvars.has_key(var) and self.envvars[var] and \ if self.envvars.has_key(var) and self.envvars[var] and \
(var.endswith('FLAGS') or exists(self.envvars[var])): (var.endswith('FLAGS') or exists(self.envvars[var])):
@ -1237,6 +1245,11 @@ class PrepareBuild(CommandLineApp):
if not self.options.no_patch: if not self.options.no_patch:
self.phase_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: else:
if not self.options.no_patch and \ if not self.options.no_patch and \
self.isnewer('Makefile', '.timestamp'): self.isnewer('Makefile', '.timestamp'):

View file

@ -5,93 +5,55 @@
STOW_ROOT = /usr/local/stow STOW_ROOT = /usr/local/stow
PRODUCTS = $(HOME)/Products PRODUCTS = $(HOME)/Products
EXTRA_DEFINES = -D_GLIBCXX_FULLY_DYNAMIC_STRING=1 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_SOURCE = boost BOOST_VERSION = 1_41_0
BOOST_VERSION = 1_40_0 BOOST_SOURCE = boost_$(BOOST_VERSION)
BOOST_TOOLSET = darwin 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) \ BOOST_FLAGS = --toolset=$(BOOST_TOOLSET) \
--build-type=complete --layout=versioned \ --build-type=complete --layout=versioned \
$(BOOST_DEFINES) $(BOOST_DEFINES)
ICU_FLAGS = -sHAVE_ICU=1 -sICU_PATH=$(STOW_ROOT)/icu ICU_FLAGS = -sHAVE_ICU=1 -sICU_PATH=$(STOW_ROOT)/icu
ICU_DBG_FLAGS = -sHAVE_ICU=1 -sICU_PATH=$(STOW_ROOT)/icu-debug
icu-release: all: boost-build cppunit-build icu-build boost-icu-build
-(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)
icu-debug: boost-build:
-(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:
(cd $(BOOST_SOURCE) && \ (cd $(BOOST_SOURCE) && \
bjam debug --prefix=$(STOW_ROOT)/boost_$(BOOST_VERSION) \ bjam debug --prefix=$(STOW_ROOT)/boost_$(BOOST_VERSION) \
--build-dir=$(PRODUCTS)/boost_$(BOOST_VERSION) \ --build-dir=$(PRODUCTS)/boost_$(BOOST_VERSION) \
$(BOOST_FLAGS) define=_GLIBCXX_DEBUG=1 install) $(BOOST_FLAGS) install)
boost-build: boost-release boost-debug cppunit-build:
cppunit-release:
-(cd cppunit; make distclean) -(cd cppunit; make distclean)
(cd cppunit; sh autogen.sh; \ (cd cppunit; sh autogen.sh; \
./configure CPPFLAGS="$(EXTRA_DEFINES)" \ ./configure CPPFLAGS="$(CPPFLAGS)" \
CFLAGS="$(EXTRA_DEFINES) $(ARCH_CFLAGS)" \ CFLAGS="$(CFLAGS)" \
LDFLAGS="$(ARCH_LDFLAGS)" \ LDFLAGS="$(LDFLAGS)" \
CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \ CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \
--prefix=$(STOW_ROOT)/cppunit \ --prefix=$(STOW_ROOT)/cppunit \
--disable-doxygen --disable-dot && \ --disable-doxygen --disable-dot && \
make install) make install)
cppunit-debug: icu-build:
-(cd cppunit; make distclean) -(cd icu/source; make distclean)
(cd cppunit; sh autogen.sh; \ (cd icu/source; sh autogen.sh; \
./configure CPPFLAGS="-D_GLIBCXX_DEBUG=1 $(EXTRA_DEFINES)" \ ./configure CPPFLAGS="$(CPPFLAGS)" \
CFLAGS="-g $(EXTRA_DEFINES) $(ARCH_CFLAGS)" \ CFLAGS="$(CFLAGS)" \
LDFLAGS="-g $(ARCH_LDFLAGS)" \ LDFLAGS="$(LDFLAGS)" \
CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \ CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \
--prefix=$(STOW_ROOT)/cppunit-debug \ --enable-static --enable-debug \
--disable-doxygen --disable-dot && \ --prefix=$(STOW_ROOT)/icu && \
make install) make install)
cppunit-build: cppunit-release cppunit-debug boost-icu-build:
(cd $(BOOST_SOURCE) && \
all: boost-build boost-icu-build cppunit-build bjam debug --prefix=$(STOW_ROOT)/boost_$(BOOST_VERSION)-icu \
--build-dir=$(PRODUCTS)/boost_$(BOOST_VERSION)-icu \
$(BOOST_FLAGS) $(ICU_FLAGS) install)

View file

@ -185,7 +185,7 @@ protected:
symbol(_symbol), precision(0), searched(false) { symbol(_symbol), precision(0), searched(false) {
TRACE_CTOR(base_t, "const string&"); TRACE_CTOR(base_t, "const string&");
} }
~base_t() { virtual ~base_t() {
TRACE_DTOR(base_t); TRACE_DTOR(base_t);
} }

View file

@ -430,12 +430,22 @@ changed_value_posts::changed_value_posts(post_handler_ptr handler,
display_total_expr = report.HANDLER(display_total_).expr; display_total_expr = report.HANDLER(display_total_).expr;
changed_values_only = report.HANDLED(revalued_only); 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 = 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); 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 = 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); losses_equity_account->add_flags(ACCOUNT_GENERATED);
} }

View file

@ -115,7 +115,8 @@ void item_t::set_tag(const string& tag,
assert(result.second); 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 (const char * b = std::strchr(p, '[')) {
if (*(b + 1) != '\0' && 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) { if (note) {
*note += '\n'; *note += '\n';

View file

@ -316,7 +316,7 @@ optional<price_point_t> commodity_pool_t::parse_price_directive(char * line)
price_point_t point; price_point_t point;
point.when = datetime; point.when = datetime;
point.price.parse(symbol_and_price); point.price.parse(symbol_and_price, PARSE_NO_MIGRATE);
VERIFY(point.price.valid()); VERIFY(point.price.valid());
DEBUG("commodity.download", "Looking up symbol: " << symbol); DEBUG("commodity.download", "Looking up symbol: " << symbol);

View file

@ -84,7 +84,7 @@ public:
explicit commodity_pool_t(); explicit commodity_pool_t();
~commodity_pool_t() { virtual ~commodity_pool_t() {
TRACE_DTOR(commodity_pool_t); TRACE_DTOR(commodity_pool_t);
foreach (commodities_map::value_type pair, commodities) foreach (commodities_map::value_type pair, commodities)
checked_delete(pair.second); checked_delete(pair.second);

View file

@ -887,6 +887,8 @@ option_t<report_t> * report_t::lookup_option(const char * p)
OPT(unbudgeted); OPT(unbudgeted);
else OPT(uncleared); else OPT(uncleared);
else OPT(unrealized); else OPT(unrealized);
else OPT(unrealized_gains_);
else OPT(unrealized_losses_);
else OPT(unround); else OPT(unround);
else OPT(unsorted); else OPT(unsorted);
break; break;

View file

@ -302,6 +302,8 @@ public:
HANDLER(unbudgeted).report(out); HANDLER(unbudgeted).report(out);
HANDLER(uncleared).report(out); HANDLER(uncleared).report(out);
HANDLER(unrealized).report(out); HANDLER(unrealized).report(out);
HANDLER(unrealized_gains_).report(out);
HANDLER(unrealized_losses_).report(out);
HANDLER(unround).report(out); HANDLER(unround).report(out);
HANDLER(unsorted).report(out); HANDLER(unsorted).report(out);
HANDLER(weekly).report(out); HANDLER(weekly).report(out);
@ -876,6 +878,9 @@ public:
OPTION(report_t, unrealized); OPTION(report_t, unrealized);
OPTION(report_t, unrealized_gains_);
OPTION(report_t, unrealized_losses_);
OPTION_(report_t, unround, DO() { OPTION_(report_t, unround, DO() {
parent->HANDLER(display_amount_) parent->HANDLER(display_amount_)
.set_expr(string("--unround"), "unrounded(amount_expr)"); .set_expr(string("--unround"), "unrounded(amount_expr)");

View file

@ -42,14 +42,17 @@ void symbol_scope_t::define(const symbol_t::kind_t kind,
{ {
DEBUG("scope.symbols", "Defining '" << name << "' = " << def); DEBUG("scope.symbols", "Defining '" << name << "' = " << def);
std::pair<symbol_map::iterator, bool> result if (! symbols)
= symbols.insert(symbol_map::value_type(symbol_t(kind, name, def), def)); symbols = symbol_map();
if (! result.second) {
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), std::pair<symbol_map::iterator, bool> result
= 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);
result = symbols->insert(symbol_map::value_type(symbol_t(kind, name, def),
def)); def));
if (! result.second) if (! result.second)
throw_(compile_error, throw_(compile_error,
@ -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, expr_t::ptr_op_t symbol_scope_t::lookup(const symbol_t::kind_t kind,
const string& name) const string& name)
{ {
symbol_map::const_iterator i = symbols.find(symbol_t(kind, name)); if (symbols) {
if (i != symbols.end()) symbol_map::const_iterator i = symbols->find(symbol_t(kind, name));
if (i != symbols->end())
return (*i).second; return (*i).second;
}
return child_scope_t::lookup(kind, name); return child_scope_t::lookup(kind, name);
} }

View file

@ -172,7 +172,7 @@ class symbol_scope_t : public child_scope_t
{ {
typedef std::map<symbol_t, expr_t::ptr_op_t> symbol_map; typedef std::map<symbol_t, expr_t::ptr_op_t> symbol_map;
symbol_map symbols; optional<symbol_map> symbols;
public: public:
explicit symbol_scope_t() { explicit symbol_scope_t() {

View file

@ -1,5 +1,7 @@
pricedb --pricedb-format='P %(date) %(scrub(display_amount))\n' 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 13:30:00 AAPL $10.00
P 2009/01/01 14:30:00 AAPL $20.00 P 2009/01/01 14:30:00 AAPL $20.00
P 2009/01/01 15:30:00 AAPL $30.00 P 2009/01/01 15:30:00 AAPL $30.00

View file

@ -1,5 +1,7 @@
prices --prices-format='%(datetime) %(scrub(display_amount))\n' 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 13:30:00 AAPL $10.00
P 2009/01/01 14:30:00 AAPL $20.00 P 2009/01/01 14:30:00 AAPL $20.00
P 2009/01/01 15:30:00 AAPL $30.00 P 2009/01/01 15:30:00 AAPL $30.00

View file

@ -1,5 +1,7 @@
reg -V --end=2009/06/16 reg -V --end=2009/06/16
<<< <<<
D 1000.00 EUR
2008/04/15 * Paid expenses back from cie. 2008/04/15 * Paid expenses back from cie.
Expenses:Cie-Reimbursements 2000 CAD @ 1.10 EUR Expenses:Cie-Reimbursements 2000 CAD @ 1.10 EUR
Assets:Checking Assets:Checking

View file

@ -232,7 +232,7 @@ ledger_la_CPPFLAGS = $(libledger_python_la_CPPFLAGS)
ledger_la_SOURCES = src/pyledger.cc ledger_la_SOURCES = src/pyledger.cc
ledger_la_DEPENDENCIES = $(lib_LTLIBRARIES) ledger_la_DEPENDENCIES = $(lib_LTLIBRARIES)
ledger_la_LDFLAGS = -avoid-version -module 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 pkgpython_PYTHON = python/__init__.py python/server.py