summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README-1ST1
-rwxr-xr-xacprep35
-rw-r--r--doc/ledger3.texi21
-rw-r--r--lib/Makefile17
-rw-r--r--src/amount.cc23
-rwxr-xr-xtools/genuuid28
6 files changed, 79 insertions, 46 deletions
diff --git a/README-1ST b/README-1ST
index 88174308..4643d655 100644
--- a/README-1ST
+++ b/README-1ST
@@ -101,6 +101,7 @@ it's usually fairly obvious where things have gone astray.
exact same Python as the Ledger executable. In particular I see this
bug on OS X systems where boost_python is linked against the default
Python, while Ledger is linked against the version provided by MacPorts.
+ Or vice versa.
Solution: Use one or the other. If you prefer the system Python, run
"port deactivate -f python26", to get MacPorts' version out of the way.
diff --git a/acprep b/acprep
index 1d0fa795..f6b201a0 100755
--- a/acprep
+++ b/acprep
@@ -209,7 +209,7 @@ class BoostInfo(object):
def dependencies(self, system):
if system == 'darwin':
- return [ 'boost-jam', 'boost', '+icu+python26+st+universal' ]
+ return [ 'boost-jam', 'boost', '+icu+python27+st+universal' ]
if system == 'centos':
return [ 'boost-devel' ]
@@ -400,8 +400,9 @@ class PrepareBuild(CommandLineApp):
self.LDFLAGS = []
self.envvars = {
+ 'PYTHON': '/usr/bin/python',
'PYTHON_HOME': '/usr',
- 'PYTHON_VERSION': '2.6',
+ 'PYTHON_VERSION': '2.7',
'LEDGER_PRODUCTS': None,
'CC': 'gcc',
'CPPFLAGS': '',
@@ -817,7 +818,7 @@ class PrepareBuild(CommandLineApp):
packages = [
'sudo', 'port', 'install', '-f',
'automake', 'autoconf', 'libtool',
- 'python26', '+universal',
+ 'python27', '+universal',
'libiconv', '+universal',
'zlib', '+universal',
'gmp' ,'+universal', 'mpfr', '+universal',
@@ -929,7 +930,7 @@ class PrepareBuild(CommandLineApp):
boost_include = self.boost_info.include_directory()
boost_library = self.boost_info.library_directory()
- if re.match('/opt/local', self.boost_info.home_path):
+ if re.match('/(usr|opt)/local', self.boost_info.home_path):
self.log.debug("Setting Python home to /opt/local based on Boost's location")
self.envvars['PYTHON_HOME'] = '/opt/local'
@@ -946,6 +947,13 @@ class PrepareBuild(CommandLineApp):
self.log.info('Noticing include directory => ' + path)
self.sys_include_dirs.append(path)
+ includes = string.split(self.get_stdout('python-config',
+ '--includes'), '-I')
+ for include in includes:
+ include = include.strip()
+ if include and include not in self.sys_include_dirs:
+ self.sys_include_dirs.append(include)
+
# Each of these becomes '-L<name>'
for path in ['/usr/local/lib',
'%s/lib' % self.envvars['PYTHON_HOME'],
@@ -961,12 +969,14 @@ class PrepareBuild(CommandLineApp):
self.sys_library_dirs.append(path)
def setup_for_johnw(self):
+ self.envvars['PYTHON'] = '/opt/local/bin/python'
+ self.envvars['PYTHON_HOME'] = '/opt/local'
+
if self.options.use_clang:
self.boost_inc_ident = "clang"
self.boost_lib_ident = "clang-darwin28"
self.log.debug("Setting Python home to /opt/local")
- self.envvars['PYTHON_HOME'] = '/opt/local'
self.log.debug('Using Clang ident: %s/%s' %
(self.boost_inc_ident, self.boost_lib_ident))
@@ -1040,28 +1050,21 @@ class PrepareBuild(CommandLineApp):
self.envvars['LD'] = '/usr/bin/g++-4.2'
self.darwin_gcc = True
elif exists('/opt/local/bin/g++-mp-4.6') and \
- not self.options.gcc45:
+ self.options.gcc46:
self.envvars['CC'] = '/opt/local/bin/gcc-mp-4.6'
#if exists('/Users/johnw/bin/gfilt'):
# self.envvars['CXX'] = '/Users/johnw/bin/gfilt'
#else:
self.envvars['CXX'] = '/opt/local/bin/g++-mp-4.6'
self.envvars['LD'] = '/opt/local/bin/g++-mp-4.6'
- elif exists('/opt/local/bin/g++-mp-4.5'):
+ elif exists('/opt/local/bin/g++-mp-4.5') and \
+ self.options.gcc45:
self.envvars['CC'] = '/opt/local/bin/gcc-mp-4.5'
if exists('/Users/johnw/bin/gfilt'):
self.envvars['CXX'] = '/Users/johnw/bin/gfilt'
else:
self.envvars['CXX'] = '/opt/local/bin/g++-mp-4.5'
self.envvars['LD'] = '/opt/local/bin/g++-mp-4.5'
- elif exists('/opt/local/bin/g++-mp-4.4'):
- self.envvars['CC'] = '/opt/local/bin/gcc-mp-4.4'
- self.envvars['CXX'] = '/opt/local/bin/g++-mp-4.4'
- self.envvars['LD'] = '/opt/local/bin/g++-mp-4.4'
- elif exists('/opt/local/bin/g++-mp-4.3'):
- self.envvars['CC'] = '/opt/local/bin/gcc-mp-4.3'
- self.envvars['CXX'] = '/opt/local/bin/g++-mp-4.3'
- self.envvars['LD'] = '/opt/local/bin/g++-mp-4.3'
elif exists('/usr/bin/g++-4.2'):
self.envvars['CC'] = '/usr/bin/gcc-4.2'
self.envvars['CXX'] = '/usr/bin/g++-4.2'
@@ -1296,7 +1299,9 @@ class PrepareBuild(CommandLineApp):
if self.options.gcc45 or self.options.gcc46:
self.CXXFLAGS.append('-g2')
+ self.CXXFLAGS.append('-ggdb')
self.LDFLAGS.append('-g2')
+ self.LDFLAGS.append('-ggdb')
else:
self.CXXFLAGS.append('-g')
self.LDFLAGS.append('-g')
diff --git a/doc/ledger3.texi b/doc/ledger3.texi
index 1f875764..1d006498 100644
--- a/doc/ledger3.texi
+++ b/doc/ledger3.texi
@@ -188,7 +188,7 @@ associated commodity. This commodity can appear before or after the
amount, and may or may not be separated from it by a space. Most
characters are allowed in a commodity name, except for the following:
-@itemize
+@itemize @bullet
@item Any kind of whitespace
@item Numerical digits
@item Punctuation: @samp{.,;:?!}
@@ -214,18 +214,17 @@ in the same form as parsed. If you specify dollar amounts using
@samp{$100.000}. You may even use decimal commas, such as
@samp{$100,00}, or thousand-marks, as in @samp{$10,000.00}.
-These display characteristics become associated with the commodity,
-with the result being that all amounts of the same commodity are
-reported consistently. Where this is most noticeable is the
-@dfn{display precision}, which is determined by the most precise value
-seen for a given commodity. In most cases.
+These display characteristics become associated with the commodity, with
+the result being that all amounts of the same commodity are reported
+consistently. Where this is most noticeable is the @dfn{display
+precision}, which is determined by the most precise value seen for a
+given commodity---in most cases.
-Ledger makes a distinction by @dfn{observed amounts} and unobserved
+Ledger makes a distinction between @dfn{observed amounts} and unobserved
amounts. An observed amount is critiqued by Ledger to determine how
-amounts using that commodity should be displayed; unobserved amounts
-are significant in their value only---no matter how they are
-specified, it does not change how other amounts in that commodity will
-be displayed.
+amounts using that commodity should be displayed; unobserved amounts are
+significant in their value only---no matter how they are specified, it
+does not change how other amounts in that commodity will be displayed.
An example of this is found in cost expressions, covered next.
diff --git a/lib/Makefile b/lib/Makefile
index 734816af..bc9611f0 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -5,7 +5,7 @@
STOW_ROOT = /usr/local/stow
PRODUCTS = $(HOME)/Products
-GCC_VERSION = 4.5
+GCC_VERSION = 4.6
BOOST_VERSION = 1_47_0
CC = gcc-mp-$(GCC_VERSION)
@@ -13,19 +13,19 @@ ifeq ($(CC),clang)
CXX = clang++
LD = llvm-ld
DIR_SUFFIX = clang
-OPTJ =
+OPTJ =
else
CXX = g++-mp-$(GCC_VERSION)
LD = gcc-mp-$(GCC_VERSION)
DIR_SUFFIX = gcc$(subst .,,$(GCC_VERSION))
-OPTJ = #-j8
+OPTJ = #-j8
endif
CPPFLAGS = -D_GLIBCXX_FULLY_DYNAMIC_STRING=1
ifneq ($(CC),clang)
CPPFLAGS += -D_GLIBCXX_DEBUG=1
endif
-CFLAGS = $(CPPFLAGS) -g
-LDFLAGS = -g
+CFLAGS = $(CPPFLAGS) -g2 -ggdb
+LDFLAGS = -g2 -ggdb
BOOST_SOURCE = boost-release
BOOST_DEFINES = define=_GLIBCXX_FULLY_DYNAMIC_STRING=1
@@ -36,9 +36,8 @@ BOOST_TOOLSET = darwin
BOOST_DEFINES += define=_GLIBCXX_DEBUG=1
endif
#BOOST_FLAGS = --architecture=x86 --address_model=32_64
-BOOST_FLAGS = toolset=$(BOOST_TOOLSET) \
- --build-type=complete --layout=versioned \
- $(BOOST_DEFINES)
+BOOST_FLAGS = toolset=$(BOOST_TOOLSET) --layout=versioned \
+ link=shared threading=single $(BOOST_DEFINES)
BOOST_DIR = boost_$(BOOST_VERSION)-$(DIR_SUFFIX)
BOOST_STOW = $(STOW_ROOT)/$(BOOST_DIR)
BOOST_BUILD = $(PRODUCTS)/$(BOOST_DIR)
@@ -56,7 +55,7 @@ prepare-boost:
boost-build: prepare-boost
(cd $(BOOST_SOURCE) && \
sh bootstrap.sh && \
- ./bjam $(OPTJ) debug --prefix=$(BOOST_STOW) \
+ ./b2 $(OPTJ) debug --prefix=$(BOOST_STOW) \
--build-dir=$(BOOST_BUILD) \
$(BOOST_FLAGS) install)
diff --git a/src/amount.cc b/src/amount.cc
index 808f118d..99e346b7 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -115,6 +115,7 @@ namespace {
mpq_t quant,
amount_t::precision_t precision,
int zeros_prec = -1,
+ mpfr_rnd_t rnd = MPFR_RNDN,
const optional<commodity_t&>& comm = none)
{
char * buf = NULL;
@@ -135,7 +136,7 @@ namespace {
DEBUG("amount.convert", "num prec = " << num_prec);
mpfr_set_prec(tempfnum, num_prec);
- mpfr_set_z(tempfnum, mpq_numref(quant), GMP_RNDN);
+ mpfr_set_z(tempfnum, mpq_numref(quant), rnd);
mp_prec_t den_prec = mpz_sizeinbase(mpq_denref(quant), 2);
den_prec += amount_t::extend_by_digits*64;
@@ -144,10 +145,10 @@ namespace {
DEBUG("amount.convert", "den prec = " << den_prec);
mpfr_set_prec(tempfden, den_prec);
- mpfr_set_z(tempfden, mpq_denref(quant), GMP_RNDN);
+ mpfr_set_z(tempfden, mpq_denref(quant), rnd);
mpfr_set_prec(tempfb, num_prec + den_prec);
- mpfr_div(tempfb, tempfnum, tempfden, GMP_RNDN);
+ mpfr_div(tempfb, tempfnum, tempfden, rnd);
if (mpfr_asprintf(&buf, "%.*RNf", precision, tempfb) < 0)
throw_(amount_error,
@@ -669,7 +670,7 @@ void amount_t::in_place_floor()
_dup();
std::ostringstream out;
- stream_out_mpq(out, MP(quantity), precision_t(0));
+ stream_out_mpq(out, MP(quantity), precision_t(0), -1, MPFR_RNDZ);
mpq_set_str(MP(quantity), out.str().c_str(), 10);
}
@@ -844,8 +845,8 @@ double amount_t::to_double() const
if (! quantity)
throw_(amount_error, _("Cannot convert an uninitialized amount to a double"));
- mpfr_set_q(tempf, MP(quantity), GMP_RNDN);
- return mpfr_get_d(tempf, GMP_RNDN);
+ mpfr_set_q(tempf, MP(quantity), MPFR_RNDN);
+ return mpfr_get_d(tempf, MPFR_RNDN);
}
long amount_t::to_long() const
@@ -853,14 +854,14 @@ long amount_t::to_long() const
if (! quantity)
throw_(amount_error, _("Cannot convert an uninitialized amount to a long"));
- mpfr_set_q(tempf, MP(quantity), GMP_RNDN);
- return mpfr_get_si(tempf, GMP_RNDN);
+ mpfr_set_q(tempf, MP(quantity), MPFR_RNDN);
+ return mpfr_get_si(tempf, MPFR_RNDN);
}
bool amount_t::fits_in_long() const
{
- mpfr_set_q(tempf, MP(quantity), GMP_RNDN);
- return mpfr_fits_slong_p(tempf, GMP_RNDN);
+ mpfr_set_q(tempf, MP(quantity), MPFR_RNDN);
+ return mpfr_fits_slong_p(tempf, MPFR_RNDN);
}
commodity_t& amount_t::commodity() const
@@ -1239,7 +1240,7 @@ void amount_t::print(std::ostream& _out, const uint_least8_t flags) const
}
stream_out_mpq(out, MP(quantity), display_precision(),
- comm ? commodity().precision() : 0, comm);
+ comm ? commodity().precision() : 0, MPFR_RNDN, comm);
if (comm.has_flags(COMMODITY_STYLE_SUFFIXED)) {
if (comm.has_flags(COMMODITY_STYLE_SEPARATED))
diff --git a/tools/genuuid b/tools/genuuid
new file mode 100755
index 00000000..53fb7a0a
--- /dev/null
+++ b/tools/genuuid
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import re
+import sys
+
+def scan_path(path):
+ bug = uuid = None
+ with open(path, 'r') as fd:
+ for line in fd:
+ match = re.match('\*', line)
+ if match:
+ bug = uuid = None
+
+ match = re.search('\[\[bug:([0-9]+)\]\[#[0-9]+\]\]', line)
+ if match:
+ bug = match.group(1)
+ elif bug:
+ match = re.search(':ID:\s+(.+?)\s*$', line)
+ if match:
+ uuid = match.group(1)
+ print "UPDATE bugs SET cf_uuid='%s' WHERE bug_id=%s;" % (uuid, bug)
+
+scan_path('/Users/johnw/src/ledger/plan/TODO')
+scan_path('/Users/johnw/src/ledger/plan/TODO-3.0')
+scan_path('/Users/johnw/src/ledger/plan/TODO-2.6.2')
+scan_path('/Users/johnw/src/ledger/plan/TODO-2.6.1')
+
+### genuuid ends here