From 10359fd7014e5d33fdc6ee7cba6d98b10054cecc Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 27 Apr 2014 10:00:04 +0200 Subject: gendocs: add option to choose pdf papersize The default will be US Letter [ci skip] --- tools/gendocs.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/gendocs.sh b/tools/gendocs.sh index 9126a406..3d082024 100755 --- a/tools/gendocs.sh +++ b/tools/gendocs.sh @@ -1,5 +1,19 @@ #!/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 + echo "===================================== Making Info..." makeinfo ledger3.texi echo "===================================== Making PDF..." -texi2pdf --quiet --batch ledger3.texi +texi2pdf --quiet --batch ${papersize} ledger3.texi -- cgit v1.2.3 From d8bbe78756d02f7964095dcc5bebbf158f9c4acf Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 27 Apr 2014 10:01:01 +0200 Subject: gendocs: make html documentation [ci skip] --- tools/gendocs.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/gendocs.sh b/tools/gendocs.sh index 3d082024..48b6a943 100755 --- a/tools/gendocs.sh +++ b/tools/gendocs.sh @@ -15,5 +15,7 @@ esac echo "===================================== Making Info..." makeinfo ledger3.texi +echo "===================================== Making HTML..." +makeinfo --html --no-split ledger3.texi echo "===================================== Making PDF..." texi2pdf --quiet --batch ${papersize} ledger3.texi -- cgit v1.2.3 From 0e496b4f9ba9b8376283bfe202d28bb538c438cc Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 27 Apr 2014 10:04:05 +0200 Subject: gendocs: use hombrew texinfo on mac if installed The default texinfo (4.8) on Mac OS X shows odd warnings from a sed call and generates verbatim html tags in links if the part of the link was marked with @command{}. With a current version of texinfo (5.2) these oddities are gone. [ci skip] --- tools/gendocs.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/gendocs.sh b/tools/gendocs.sh index 48b6a943..483f0230 100755 --- a/tools/gendocs.sh +++ b/tools/gendocs.sh @@ -13,6 +13,14 @@ case $1 in 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..." -- cgit v1.2.3 From e167cbb64713ec1feeefaa98594361069c973faa Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 27 Apr 2014 11:06:02 +0200 Subject: doc: try to use groff if man2html is not found to generate a html version of the manpage, throw a fatal error otherwise. --- doc/CMakeLists.txt | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 2777da68..f0ead658 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -37,6 +37,7 @@ set(info_files ledger3.texi ledger-mode.texi) find_program(MAKEINFO makeinfo) find_program(TEXI2PDF texi2pdf) find_program(MAN2HTML man2html) +find_program(GROFF groff) ######################################################################## @@ -72,15 +73,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) ######################################################################## -- cgit v1.2.3 From c933e7859922c04cafcd145090c7546e8d8d2d60 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 27 Apr 2014 11:08:01 +0200 Subject: doc: add BUILD_A4_PDF cmake variable to create a DIN A4 paper version of the ledger pdf. --- doc/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index f0ead658..15f1318c 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -58,8 +58,11 @@ foreach(file ${info_files}) if(NOT TEXI2PDF) message(WARNING "Could not find texi2pdf. 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) -- cgit v1.2.3 From 507fac7e507508979b1db48cf4c2cadc795f332e Mon Sep 17 00:00:00 2001 From: Jamie Nguyen Date: Sun, 27 Apr 2014 19:15:15 +0100 Subject: Fix @node pointer errors Unfortunately, you cannot reliably use periods, commas, or colons within a node name; these can confuse the Info reader. --- doc/ledger3.texi | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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 -- cgit v1.2.3 From 07b206bf6abe582ff155a4094fd81d002469ba5d Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 27 Apr 2014 20:30:12 -0500 Subject: Add the --no-pager option --- src/report.h | 1 + 1 file changed, 1 insertion(+) 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); -- cgit v1.2.3 From 81e12aa1f251b6fa27c86a08996d748de2718222 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 4 May 2014 01:06:57 +0200 Subject: acprep: fix verbose build when using ninja --- acprep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acprep b/acprep index 754a2427..1faeb4f6 100755 --- a/acprep +++ b/acprep @@ -942,7 +942,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)) -- cgit v1.2.3 From cdfd7e58503e6f71212b734b7c85f1ed8ccaf3b7 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 4 May 2014 01:13:05 +0200 Subject: Disable BUILD_DOCS by default since a separate acprep make doc is necessary to build the documentation --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7289748..a6e52f95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) -- cgit v1.2.3 From 87bcfee8fd3054fa22deb1cc2e8eb32943c509e3 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 4 May 2014 01:14:39 +0200 Subject: Build info version of documentation --- doc/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 15f1318c..cd68f828 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -43,6 +43,17 @@ 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.") -- cgit v1.2.3 From 851dea238ac230d44c5df00dd738cee9aa5780d3 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 4 May 2014 01:16:19 +0200 Subject: Check for required TeX when building pdf documentation --- doc/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index cd68f828..e359c5e4 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -36,6 +36,7 @@ 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) @@ -56,9 +57,8 @@ foreach(file ${info_files}) 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} @@ -66,8 +66,8 @@ 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) -- cgit v1.2.3 From dcb285ac556aa54aa01c60b3c1c9fa40199d8f06 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sun, 4 May 2014 01:17:02 +0200 Subject: Improve installation of documentation files - Install info version of ledger documentation instead of the original texinfo sources - Install html version of ledger documentation when BUILD_WEB_DOCS is ON - Enable installation of documentation files from --output directory --- acprep | 3 +++ doc/CMakeLists.txt | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/acprep b/acprep index 1faeb4f6..f9fb74d7 100755 --- a/acprep +++ b/acprep @@ -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()) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index e359c5e4..8a9ba2fd 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -120,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() -- cgit v1.2.3 From 73caafa2c540384f19669567ed95b598fcf42463 Mon Sep 17 00:00:00 2001 From: Johann Klähn Date: Wed, 7 May 2014 19:08:06 +0200 Subject: fix debug build for gcc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -ansi ≡ -std=c++98 ;) --- src/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a77422db..e8b2af53 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -185,7 +185,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_CXX_COMPILER MATCHES "g\\+\\+") set(GXX_WARNING_FLAGS - -ansi -pedantic -Wall -Winvalid-pch -- cgit v1.2.3 From 1aa0e03a9e7f9f1a51395a60fc1336bea3ca2aa9 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 7 May 2014 20:49:45 +0000 Subject: Fix build for building with g++ 4.8 --- CMakeLists.txt | 2 +- acprep | 6 +++--- default.nix | 2 +- src/CMakeLists.txt | 2 ++ src/utils.cc | 8 ++++++++ 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6e52f95..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() diff --git a/acprep b/acprep index f9fb74d7..0155ec73 100755 --- a/acprep +++ b/acprep @@ -875,9 +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.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()) 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/src/CMakeLists.txt b/src/CMakeLists.txt index e8b2af53..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}) @@ -222,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/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); -- cgit v1.2.3 From c254bea7975b56675fe55cb44125ded55cb79f35 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 7 May 2014 20:52:37 +0000 Subject: Restore -DBUILD_DIR --- acprep | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acprep b/acprep index 0155ec73..f9fb74d7 100755 --- a/acprep +++ b/acprep @@ -875,9 +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.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()) -- cgit v1.2.3 From 1e5cf0c924d0a4cd6a0c863b1e163bd8db65dbea Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Thu, 8 May 2014 12:07:17 +0200 Subject: Add script to generate commodities from ISO 4217 [ci skip] --- contrib/iso4127-commodities/iso4217ledger.sh | 54 ++++++++++ contrib/iso4127-commodities/iso4217ledger.xsl | 138 ++++++++++++++++++++++++++ 2 files changed, 192 insertions(+) create mode 100755 contrib/iso4127-commodities/iso4217ledger.sh create mode 100644 contrib/iso4127-commodities/iso4217ledger.xsl 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 @@ + + + + + + + + + + + , + + + + + + + + + + + ; Ledger commodity declarations +; Generated from ISO 4217 Table A.1 XML ( + +) using iso4217ledger.xsl + + + + + + + + + + + + + + ¤ + + + + + commodity + + + + note + + - + + + ( + + ) + + + + format + + 0000 + + + + + + + + + + + + + + + + + + + nomarket + + + + + + + + + + 0 + + + + + + + -- cgit v1.2.3 From bd8a1a67560f1ff8c443351b55b4731f1be04126 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 8 May 2014 19:22:17 +0000 Subject: Use the POST_COST_VIRTUAL flag when exchange commodities Fixes #999 --- src/pool.cc | 3 ++- src/xact.cc | 6 +++--- test/regress/999.test | 6 ++++++ 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 test/regress/999.test 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/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 -- cgit v1.2.3 From 9da91b8faee8b77986246329cfafb7c363a17944 Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Fri, 9 May 2014 21:03:26 +0100 Subject: Refactor macros in ledger-context.el to byte compile cleanly --- lisp/ledger-context.el | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) 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. -- cgit v1.2.3