diff options
author | Craig Earls <enderw88@gmail.com> | 2014-05-09 20:40:42 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2014-05-09 20:40:42 -0700 |
commit | 20b915668f7e6d4be9993e11dfc04ae1760a36f7 (patch) | |
tree | 668de51ac7625355aaaa8c3c88aed82344c690c3 | |
parent | 2906a2f759b67363c070161202596e746921f09c (diff) | |
parent | dbfbf2bc893de3c44dcc08c33811bc274f647672 (diff) | |
download | fork-ledger-20b915668f7e6d4be9993e11dfc04ae1760a36f7.tar.gz fork-ledger-20b915668f7e6d4be9993e11dfc04ae1760a36f7.tar.bz2 fork-ledger-20b915668f7e6d4be9993e11dfc04ae1760a36f7.zip |
Merge commit 'dbfbf2bc893de3c44dcc08c33811bc274f647672'
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rwxr-xr-x | acprep | 5 | ||||
-rwxr-xr-x | contrib/iso4127-commodities/iso4217ledger.sh | 54 | ||||
-rw-r--r-- | contrib/iso4127-commodities/iso4217ledger.xsl | 138 | ||||
-rw-r--r-- | default.nix | 2 | ||||
-rw-r--r-- | doc/CMakeLists.txt | 62 | ||||
-rw-r--r-- | doc/ledger3.texi | 22 | ||||
-rw-r--r-- | lisp/ledger-context.el | 41 | ||||
-rw-r--r-- | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/pool.cc | 3 | ||||
-rw-r--r-- | src/report.h | 1 | ||||
-rw-r--r-- | src/utils.cc | 8 | ||||
-rw-r--r-- | src/xact.cc | 6 | ||||
-rw-r--r-- | test/regress/999.test | 6 | ||||
-rwxr-xr-x | tools/gendocs.sh | 26 |
15 files changed, 317 insertions, 64 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b7289748..8740e140 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ PROJECT(ledger) set(Ledger_VERSION_MAJOR 3) set(Ledger_VERSION_MINOR 0) set(Ledger_VERSION_PATCH 2) -set(Ledger_VERSION_DATE 20140417) +set(Ledger_VERSION_DATE 20140507) enable_testing() @@ -20,7 +20,7 @@ option(DISABLE_ASSERTS "Build without any internal consistency checks" OFF) option(BUILD_DEBUG "Build support for runtime debugging" OFF) option(BUILD_LIBRARY "Build and install Ledger as a library" ON) -option(BUILD_DOCS "Build and install documentation" ON) +option(BUILD_DOCS "Build and install documentation" OFF) option(BUILD_WEB_DOCS "Build version of documentation suitable for viewing online" OFF) option(BUILD_EMACSLISP "Build and install ledger-mode for Emacs" OFF) @@ -875,6 +875,9 @@ class PrepareBuild(CommandLineApp): if self.options.boost_include: conf_args.append('-DBOOST_INCLUDEDIR=%s' % self.options.boost_include) + if self.options.build_dir: + conf_args.append('-DBUILD_DIR=%s' % + self.options.build_dir) if self.prefix_directory(): conf_args.append('-DCMAKE_INSTALL_PREFIX=%s' % self.prefix_directory()) @@ -942,7 +945,7 @@ class PrepareBuild(CommandLineApp): make_args.append('-j%d' % self.options.jobs) if self.options.verbose: - make_args.append('VERBOSE=1') + make_args.append('-v' if self.options.use_ninja else 'VERBOSE=1') self.log.debug('Configure arguments => ' + str(config_args)) self.log.debug('Makefile arguments => ' + str(make_args)) diff --git a/contrib/iso4127-commodities/iso4217ledger.sh b/contrib/iso4127-commodities/iso4217ledger.sh new file mode 100755 index 00000000..1841abe8 --- /dev/null +++ b/contrib/iso4127-commodities/iso4217ledger.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +# iso4217ledger.sh - Convert ISO 4217 currencies to ledger commodities +# +# This script will download the latest XML for ISO 4217 Table A.1 +# and print the contained currency & funds code list as ledger +# commodity definitions to stdout. + +# Copyright (c) 2014 Alexis Hildebrandt +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +xml_url="http://www.currency-iso.org/dam/downloads/table_a1.xml" +xsl_file="$(dirname $0)/iso4217ledger.xsl" + +xsltproc="$(which xsltproc)" +if [ ! -f "$xsltproc" -o ! -x "$xsltproc" ]; then + echo "Can't find xsltproc" + exit 1 +fi + +download_command="$(which curl)" +if [ -f "$download_command" \ + -a -x "$download_command" ]; then + download_options="--silent" +else + download_command="$(which wget)" + if [ -n "$download_command" \ + -a -f "$download_command" \ + -a -x "$download_command" ]; then + download_options="--quiet --output-document -" + else + echo "Can't find curl or wget." + exit 1 + fi +fi + +$download_command $download_options "$xml_url" | $xsltproc "$xsl_file" - diff --git a/contrib/iso4127-commodities/iso4217ledger.xsl b/contrib/iso4127-commodities/iso4217ledger.xsl new file mode 100644 index 00000000..cd70d2d6 --- /dev/null +++ b/contrib/iso4127-commodities/iso4217ledger.xsl @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + ! iso4217ledger.xsl - Transform ISO 4217 Table A.1 to ledger commodities + ! + ! The current currency & funds code list is found at: + ! http://www.currency-iso.org/en/home/tables/table-a1.html + ! --> + +<!-- + ! Copyright (c) 2014 Alexis Hildebrandt + ! + ! Permission is hereby granted, free of charge, to any person obtaining a copy + ! of this software and associated documentation files (the "Software"), to deal + ! in the Software without restriction, including without limitation the rights + ! to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + ! copies of the Software, and to permit persons to whom the Software is + ! furnished to do so, subject to the following conditions: + ! + ! The above copyright notice and this permission notice shall be included in + ! all copies or substantial portions of the Software. + ! + ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ! SOFTWARE. + ! --> + +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + + <!-- + ! Set the value of this variable to your preferred decimal separator. + ! For European countries this is likely to be the comma ','. + ! --> + <xsl:variable name="decimal_separator"> + <xsl:text>,</xsl:text> + <!-- + <xsl:text>.</xsl:text> + --> + </xsl:variable> + + + <!-- + ! Ensure that plain text will be written, + ! and all whitespace from the XML source is stripped. + ! --> + <xsl:output method="text"/> + <xsl:template match="text()" /> + + <!-- + ! Add comment that the file was generated. + ! --> + <xsl:template match="/"> + <xsl:text>; Ledger commodity declarations +; Generated from ISO 4217 Table A.1 XML (</xsl:text> + <xsl:value-of select="ISO_4217/@Pblshd"/> +<xsl:text>) using iso4217ledger.xsl + +</xsl:text> + <xsl:apply-templates /> + </xsl:template> + + <!-- + ! Create ledger entry for the corresponding commodity + ! --> + <xsl:template match="CcyNtry"> + <xsl:variable name="ccy"> + <xsl:choose> + <xsl:when test="Ccy"> + <xsl:value-of select="Ccy"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>ยค</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:text>commodity </xsl:text> + <xsl:value-of select="$ccy"/> + + <xsl:text> + note </xsl:text> + <xsl:value-of select="CcyNm"/> + <xsl:text> - </xsl:text> + <xsl:value-of select="normalize-space(CtryNm)"/> + <xsl:if test="CcyNbr"> + <xsl:text> (</xsl:text> + <xsl:value-of select="CcyNbr"/> + <xsl:text>)</xsl:text> + </xsl:if> + + <xsl:text> + format </xsl:text> + <xsl:value-of select="$ccy"/><xsl:text> </xsl:text> + <xsl:text>0000</xsl:text> + <xsl:choose> + <xsl:when test="CcyMnrUnts > 0"> + <xsl:value-of select="$decimal_separator"/> + <xsl:call-template name="zero"> + <xsl:with-param name="count" select="CcyMnrUnts"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="CcyMnrUnts = 'N.A.'"> + <xsl:value-of select="$decimal_separator"/> + <xsl:call-template name="zero"> + <xsl:with-param name="count" select="3"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + </xsl:otherwise> + </xsl:choose> + + <xsl:text> + nomarket + +</xsl:text> + </xsl:template> + + + <!-- + ! Recursive template to generate 0s + ! --> + <xsl:template name="zero"> + <xsl:param name="count" select="0"/> + <xsl:if test="$count > 0"> + <xsl:text>0</xsl:text> + <xsl:call-template name="zero"> + <xsl:with-param name="count" select="$count - 1"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + +</xsl:stylesheet> diff --git a/default.nix b/default.nix index f1745ce4..cf45b06e 100644 --- a/default.nix +++ b/default.nix @@ -2,7 +2,7 @@ , texinfo, gnused }: let - rev = "20140417"; + rev = "20140507"; in stdenv.mkDerivation { diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 2777da68..8a9ba2fd 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -36,17 +36,29 @@ set(info_files ledger3.texi ledger-mode.texi) find_program(MAKEINFO makeinfo) find_program(TEXI2PDF texi2pdf) +find_program(TEX tex) find_program(MAN2HTML man2html) +find_program(GROFF groff) ######################################################################## foreach(file ${info_files}) get_filename_component(file_base ${file} NAME_WE) + + if(NOT MAKEINFO) + message(WARNING "Could not find makeinfo. Info version of documentation cannot be built.") + else() + add_custom_command(OUTPUT ${file_base}.info + COMMAND makeinfo --force --no-split -o ${file_base}.info ${CMAKE_CURRENT_SOURCE_DIR}/${file} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} + VERBATIM) + list(APPEND ledger_doc_files ${file_base}.info) + endif() + if(BUILD_WEB_DOCS) if(NOT MAKEINFO) - message(FATAL_ERROR "Could not find makeinfo. HTML version of documentation cannot be built.") + message(WARNING "Could not find makeinfo. HTML version of documentation cannot be built.") endif() - add_custom_command(OUTPUT ${file_base}.html COMMAND makeinfo --force --html --no-split -o ${file_base}.html ${CMAKE_CURRENT_SOURCE_DIR}/${file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} @@ -54,11 +66,14 @@ foreach(file ${info_files}) list(APPEND ledger_doc_files ${file_base}.html) endif(BUILD_WEB_DOCS) - if(NOT TEXI2PDF) - message(WARNING "Could not find texi2pdf. PDF version of documentation will not be built.") + if(NOT TEXI2PDF OR NOT TEX) + message(WARNING "Could not find texi2pdf or tex. PDF version of documentation will not be built.") else() + if(BUILD_A4_PDF) + set(papersize --texinfo=@afourpaper) + endif() add_custom_command(OUTPUT ${file_base}.pdf - COMMAND texi2pdf -b -q -o ${file_base}.pdf ${CMAKE_CURRENT_SOURCE_DIR}/${file} + COMMAND texi2pdf ${papersize} -b -q -o ${file_base}.pdf ${CMAKE_CURRENT_SOURCE_DIR}/${file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} VERBATIM) list(APPEND ledger_doc_files ${file_base}.pdf) @@ -72,15 +87,21 @@ if(BUILD_WEB_DOCS) if(NOT BASH) message(FATAL_ERROR "Could not find bash. Unable to build documentation.") endif() - if(NOT MAN2HTML) - message(FATAL_ERROR "Could not find man2html. HTML version of man page cannot be built.") + if(MAN2HTML) + add_custom_command(OUTPUT ledger.1.html + COMMAND ${BASH} -c "man2html ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 | tail -n+3 > ledger.1.html" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 + VERBATIM) + list(APPEND ledger_doc_files ledger.1.html) + elseif(GROFF) + add_custom_command(OUTPUT ledger.1.html + COMMAND ${BASH} -c "groff -mandoc -Thtml ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 > ledger.1.html" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 + VERBATIM) + list(APPEND ledger_doc_files ledger.1.html) + else() + message(FATAL_ERROR "Could not find man2html or groff. HTML version of man page cannot be built.") endif() - - add_custom_command(OUTPUT ledger.1.html - COMMAND ${BASH} -c "man2html ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 | tail -n+3 > ledger.1.html" - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 - VERBATIM) - list(APPEND ledger_doc_files ledger.1.html) endif(BUILD_WEB_DOCS) ######################################################################## @@ -99,8 +120,19 @@ endif(CMAKE_INSTALL_MANDIR) foreach(file ${info_files}) get_filename_component(file_base ${file} NAME_WE) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file} + if (CMAKE_SOURCE_DIR STREQUAL BUILD_DIR) + set(doc_dir CMAKE_CURRENT_SOURCE_DIR) + else() + get_filename_component(dir_base ${CMAKE_CURRENT_SOURCE_DIR} NAME_WE) + set(doc_dir "${CMAKE_SOURCE_DIR}/${BUILD_DIR}/${dir_base}") + endif() + + install(FILES ${doc_dir}/${file_base}.info DESTINATION ${CMAKE_INSTALL_INFODIR} COMPONENT doc) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file_base}.pdf + install(FILES ${doc_dir}/${file_base}.pdf DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT doc OPTIONAL) + if (BUILD_WEB_DOCS) + install(FILES ${doc_dir}/${file_base}.html + DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT doc) + endif(BUILD_WEB_DOCS) endforeach() diff --git a/doc/ledger3.texi b/doc/ledger3.texi index d5767efa..dfdafc05 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -2693,7 +2693,7 @@ doing it. * Total posting costs:: * Virtual posting costs:: * Commodity prices:: -* Prices vs. costs:: +* Prices versus costs:: * Fixated prices and costs:: * Lot dates:: * Lot notes:: @@ -3296,7 +3296,7 @@ happening in the case of an exceptional transaction, surround the Income:Gifts Received @end smallexample -@node Commodity prices, Prices vs. costs, Virtual posting costs, Transactions +@node Commodity prices, Prices versus costs, Virtual posting costs, Transactions @section Commodity prices @findex --lot-prices @@ -3424,8 +3424,8 @@ And in cases where the amounts do not divide into whole figures and must be rounded, the capital gains figure could be off by a cent. Use with caution. -@node Prices vs. costs, Fixated prices and costs, Commodity prices, Transactions -@section Prices vs. costs +@node Prices versus costs, Fixated prices and costs, Commodity prices, Transactions +@section Prices versus costs Because lot pricing provides enough information to infer the cost, the following two transactions are equivalent: @@ -3445,7 +3445,7 @@ example in the print report. Functionally, however, there is no difference, and neither the register nor the balance report are sensitive to this difference. -@node Fixated prices and costs, Lot dates, Prices vs. costs, Transactions +@node Fixated prices and costs, Lot dates, Prices versus costs, Transactions @section Fixated prices and costs If you buy a stock last year, and ask for its value today, Ledger will @@ -3476,7 +3476,7 @@ fixated prices by way of the cost: @end smallexample This is the same as the previous transaction, with the same caveats -found in @ref{Prices vs. costs}. +found in @ref{Prices versus costs}. @node Lot dates, Lot notes, Fixated prices and costs, Transactions @section Lot dates @@ -8458,13 +8458,13 @@ make sense later. @menu * Basic data traversal:: -* Raw vs. Cooked:: +* Raw versus Cooked:: * Queries:: * Embedded Python:: * Amounts:: @end menu -@node Basic data traversal, Raw vs. Cooked, Extending with Python, Extending with Python +@node Basic data traversal, Raw versus Cooked, Extending with Python, Extending with Python @section Basic data traversal Every interaction with Ledger happens in the context of a Session. @@ -8491,8 +8491,8 @@ for xact in ledger.read_journal("sample.dat").xacts: print "Transferring %s to/from %s" % (post.amount, post.account) @end smallexample -@node Raw vs. Cooked, Queries, Basic data traversal, Extending with Python -@section Raw vs. Cooked +@node Raw versus Cooked, Queries, Basic data traversal, Extending with Python +@section Raw versus Cooked Ledger data exists in one of two forms: raw and cooked. Raw objects are what you get from a traversal like the above, and represent exactly what @@ -8556,7 +8556,7 @@ does it transaction-wise. It relies on the fact that an unsorted report returns postings in the exact order they were parsed from the journal file. -@node Queries, Embedded Python, Raw vs. Cooked, Extending with Python +@node Queries, Embedded Python, Raw versus Cooked, Extending with Python @section Queries The Journal.query() method accepts every argument you can specify on the diff --git a/lisp/ledger-context.el b/lisp/ledger-context.el index 064ac380..feb4a389 100644 --- a/lisp/ledger-context.el +++ b/lisp/ledger-context.el @@ -42,43 +42,28 @@ (defconst ledger-code-string "\\((.*)\\)?") (defconst ledger-payee-string "\\(.*\\)") -(defmacro ledger-line-regex (&rest elements) - (let (regex-string) - (concat (dolist (e elements regex-string) - (setq regex-string - (concat regex-string - (eval - (intern - (concat "ledger-" (symbol-name e) "-string")))))) "[ \t]*$"))) - -(defmacro ledger-single-line-config2 (&rest elements) - "Take list of ELEMENTS and return regex and element list for use in context-at-point" - (let (regex-string) - `'(,(concat (dolist (e elements regex-string) - (setq regex-string - (concat regex-string - (eval - (intern - (concat "ledger-" (symbol-name e) "-string")))))) "[ \t]*$") - ,elements))) +(defun ledger-get-regex-str (name) + (symbol-value (intern (concat "ledger-" (symbol-name name) "-string")))) + +(defun ledger-line-regex (elements) + (concat (apply 'concat (mapcar 'ledger-get-regex-str elements)) "[ \t]*$")) (defmacro ledger-single-line-config (&rest elements) "Take list of ELEMENTS and return regex and element list for use in context-at-point" - `'(,(eval `(ledger-line-regex ,@elements)) - ,elements)) + `(list (ledger-line-regex (quote ,elements)) (quote ,elements))) (defconst ledger-line-config (list (list 'xact (list (ledger-single-line-config date nil status nil code nil payee nil comment) (ledger-single-line-config date nil status nil code nil payee) (ledger-single-line-config date nil status nil payee))) (list 'acct-transaction (list (ledger-single-line-config indent comment) - (ledger-single-line-config2 indent status account nil commodity amount nil comment) - (ledger-single-line-config2 indent status account nil commodity amount) - (ledger-single-line-config2 indent status account nil amount nil commodity comment) - (ledger-single-line-config2 indent status account nil amount nil commodity) - (ledger-single-line-config2 indent status account nil amount) - (ledger-single-line-config2 indent status account nil comment) - (ledger-single-line-config2 indent status account))))) + (ledger-single-line-config indent status account nil commodity amount nil comment) + (ledger-single-line-config indent status account nil commodity amount) + (ledger-single-line-config indent status account nil amount nil commodity comment) + (ledger-single-line-config indent status account nil amount nil commodity) + (ledger-single-line-config indent status account nil amount) + (ledger-single-line-config indent status account nil comment) + (ledger-single-line-config indent status account))))) (defun ledger-extract-context-info (line-type pos) "Get context info for current line with LINE-TYPE. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a77422db..9752b052 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -167,6 +167,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(BUILD_LIBRARY) list(APPEND _args ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) endif() + list(APPEND _args "-std=c++11 ") list(APPEND _args "-x c++-header " ${_inc}) list(APPEND _args -c ${_header_filename} -o ${_pch_filename}) @@ -185,7 +186,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_CXX_COMPILER MATCHES "g\\+\\+") set(GXX_WARNING_FLAGS - -ansi -pedantic -Wall -Winvalid-pch @@ -223,6 +223,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") list(APPEND _args ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) endif() list(APPEND _args ${GXX_WARNING_FLAGS}) + list(APPEND _args "-std=c++11 ") list(APPEND _args "-x c++-header " ${_inc}) list(APPEND _args -c ${_header_filename} -o ${_gch_filename}) diff --git a/src/pool.cc b/src/pool.cc index 4526ac0c..71bfab72 100644 --- a/src/pool.cc +++ b/src/pool.cc @@ -267,7 +267,8 @@ commodity_pool_t::exchange(const amount_t& amount, // Do not record commodity exchanges where amount's commodity has a // fixated price, since this does not establish a market value for the // base commodity. - if (! per_unit_cost.is_realzero() && + if (add_price && + ! per_unit_cost.is_realzero() && (current_annotation == NULL || ! (current_annotation->price && current_annotation->has_flags(ANNOTATION_PRICE_FIXATED))) && diff --git a/src/report.h b/src/report.h index 120a7020..c500fb9b 100644 --- a/src/report.h +++ b/src/report.h @@ -302,6 +302,7 @@ public: HANDLER(market).report(out); HANDLER(meta_).report(out); HANDLER(monthly).report(out); + HANDLER(no_pager).report(out); HANDLER(no_rounding).report(out); HANDLER(no_titles).report(out); HANDLER(no_total).report(out); diff --git a/src/utils.cc b/src/utils.cc index 2256d22a..741ce79d 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -229,7 +229,11 @@ static void trace_delete_func(void * ptr, const char * which) //#if !defined(__has_feature) || !__has_feature(address_sanitizer) +#ifdef _GLIBCXX_THROW +void * operator new(std::size_t size) _GLIBCXX_THROW(std::bad_alloc) { +#else void * operator new(std::size_t size) throw (std::bad_alloc) { +#endif void * ptr = std::malloc(size); if (DO_VERIFY() && ledger::memory_tracing_active) ledger::trace_new_func(ptr, "new", size); @@ -241,7 +245,11 @@ void * operator new(std::size_t size, const std::nothrow_t&) throw() { ledger::trace_new_func(ptr, "new", size); return ptr; } +#ifdef _GLIBCXX_THROW +void * operator new[](std::size_t size) _GLIBCXX_THROW(std::bad_alloc) { +#else void * operator new[](std::size_t size) throw (std::bad_alloc) { +#endif void * ptr = std::malloc(size); if (DO_VERIFY() && ledger::memory_tracing_active) ledger::trace_new_func(ptr, "new[]", size); diff --git a/src/xact.cc b/src/xact.cc index c7a9c6e3..eec4cff3 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -292,9 +292,9 @@ bool xact_base_t::finalize() _("A posting's cost must be of a different commodity than its amount")); cost_breakdown_t breakdown = - commodity_pool_t::current_pool->exchange - (post->amount, *post->cost, false, ! post->has_flags(POST_COST_VIRTUAL), - datetime_t(date(), time_duration(0, 0, 0, 0))); + commodity_pool_t::current_pool->exchange( + post->amount, *post->cost, false, ! post->has_flags(POST_COST_VIRTUAL), + datetime_t(date(), time_duration(0, 0, 0, 0))); if (post->amount.has_annotation() && post->amount.annotation().price) { if (breakdown.basis_cost.commodity() == breakdown.final_cost.commodity()) { diff --git a/test/regress/999.test b/test/regress/999.test new file mode 100644 index 00000000..9865eeed --- /dev/null +++ b/test/regress/999.test @@ -0,0 +1,6 @@ +2012-03-10 My Brother + Assets:Brokerage 1000 AAPL (@) $1 + Income:Gifts Received + +test prices +end test diff --git a/tools/gendocs.sh b/tools/gendocs.sh index 9126a406..483f0230 100755 --- a/tools/gendocs.sh +++ b/tools/gendocs.sh @@ -1,5 +1,29 @@ #!/bin/bash + +# By default US Letter is used as the PDF papersize. +# For those preferring other dimensions add a4 or small +# as a commandline argument to this script to create a +# DIN A4 or smallbook version of the PDF. +case $1 in + a4*|afour*) + papersize='--texinfo=@afourpaper';; + small*) + papersize='--texinfo=@smallbook';; + *) + papersize='';; # US Letter is texinfo default +esac + +# Use keg-only Mac Hombrew texinfo if installed. +# Since texi2pdf is a shell script itself executing texi2dvi +# PATH is prepended with the path to correct texinfo scripts. +if [ $(uname -s) = 'Darwin' ]; then + brew list texinfo >/dev/null 2>&1 \ + && export PATH="$(brew --prefix texinfo)/bin:$PATH" +fi + echo "===================================== Making Info..." makeinfo ledger3.texi +echo "===================================== Making HTML..." +makeinfo --html --no-split ledger3.texi echo "===================================== Making PDF..." -texi2pdf --quiet --batch ledger3.texi +texi2pdf --quiet --batch ${papersize} ledger3.texi |