diff options
284 files changed, 10490 insertions, 7094 deletions
diff --git a/.dir-locals.el b/.dir-locals.el index 4f6af924..edafaded 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,6 +1,5 @@ ((nil . ((tab-width . 2) (sentence-end-double-space . t) - (fill-column . 8) (bug-reference-url-format . "http://bugs.ledger-cli.org/show_bug.cgi?id=%s"))) (c-mode . ((c-file-style . "ledger") @@ -1,9 +1,13 @@ *.[oa] +*.so +*.so.* +*.dylib *.backup *.elc *.gcov *.l[oa] *.pyc +*.sw[p-z] *~ .timestamp *.tar.bz2 @@ -11,12 +15,9 @@ .deps/ .libs/ ABOUT-NLS -BaselineTests Makefile Makefile.am Makefile.in -PyUnitTests -RegressionTests TAGS acconf.h.in aclocal.m4 @@ -31,12 +32,16 @@ config.status config.sub configure configure.ac -data_tests depcomp doc/Doxyfile doc/*.aux doc/*.cp +doc/*.cps doc/*.fn +doc/*.fns +doc/*.html +doc/*.info +doc/*.info-* doc/*.ky doc/*.log doc/*.pdf @@ -47,12 +52,9 @@ doc/*.vr doc/.dirstamp doc/html/ doc/latex/ -doc/ledger.info -doc/ledger3.info doc/refman.pdf doc/report/ elisp-comp -expr_tests install-sh intl/ ledger @@ -60,20 +62,16 @@ libtool ltmain.sh m4/ make.sh -math_tests missing mkinstalldirs po/ py-compile -report_tests shave shave-libtool -src/system.hh.gch stamp-h1 texinfo.tex tmpcvs*/ tmpwrk*/ -util_tests dist/win/vc9/Debug/ dist/win/vc9/gen-mpir.exe dist/win/vc9/gen-mpir.ilk @@ -82,15 +80,12 @@ dist/win/vc9/ledger.ncb dist/win/vc9/ledger.vcproj.*.user dist/win/vc9/ledger.suo dist/win/vc9/lib/Win32/Debug/ -dist/win/vc9/system.hh -doc/ledger.1.html -doc/ledger.html -doc/ledger3.html src/TAGS CMakeCache.txt CPackConfig.cmake CPackSourceConfig.cmake CMakeFiles/ +CTestTestfile.cmake _CPack_Packages/ cmake_install.cmake install_manifest.txt @@ -106,7 +101,10 @@ contrib/non-profit-audit-reports/tests/general-ledger.txt contrib/non-profit-audit-reports/tests/MANIFEST contrib/non-profit-audit-reports/general-ledger.zip /wiki/ -doc/ledger-mode.info -doc/ledger3.info-1 -doc/ledger3.info-2 -CTestTestfile.cmake +.ninja_deps +.ninja_log +build.ninja +rules.ninja +test/Testing +/MathTests +/UtilTests diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..5f026e6c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,103 @@ +# Since the Travis CI environment http://docs.travis-ci.com/user/ci-environment/ +# provides GNU GCC 4.6, which does not support -std=c++11 GNU GCC 4.8 is installed + +# NOTE: Please validate this file after editing it using +# Travis WebLint http://lint.travis-ci.org/ +# or travis-yaml https://github.com/travis-ci/travis-yaml + +language: cpp +compiler: + - gcc + - clang +os: + - linux + - osx +sudo: false +cache: + apt: true + +env: + global: + # Boost version to use: + # _MIN is used when building the master branch + # _MAX is used when building any other branch + - BOOST_VERSION_MIN="1.49.0" + - BOOST_VERSION_MAX="1.58.0" + # List of required boost libraries to build + - BOOST_LIBS="date_time,filesystem,iostreams,python,regex,system,test" + # List of required Homebrew formulae to install + - BREWS="gmp,mpfr" + +matrix: + exclude: + - os: linux + compiler: clang + # Compiling ledger on Linux with clang + # either crashes clang or results in a ledger binary that crashes with SIGSEGV. + - os: osx + compiler: gcc + # On Mac OS X building ledger with GNU GCC 4.8 fails due to + # undefined symbols, maybe because boost was not being built with g++-4.8. + # Undefined symbols for architecture x86_64: + # "boost::re_detail::perl_matcher<char const*, std::allocator<boost::sub_match<char const*> >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)", referenced from: + # boost::re_detail::perl_matcher<char const*, std::allocator<boost::sub_match<char const*> >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher(char const*, char const*, boost::match_results<char const*, std::allocator<boost::sub_match<char const*> > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, char const*) in main.cc.o + # boost::re_detail::perl_matcher<char const*, std::allocator<boost::sub_match<char const*> >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher(char const*, char const*, boost::match_results<char const*, std::allocator<boost::sub_match<char const*> > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, char const*) in global.cc.o + # "boost::re_detail::perl_matcher<char const*, std::allocator<boost::sub_match<char const*> >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::find()", referenced from: + # bool boost::regex_search<char const*, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(char const*, char const*, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags) in main.cc.o + # bool boost::regex_search<char const*, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(char const*, char const*, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags) in global.cc.o + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + #- boost-latest + packages: + - gcc-4.8 + - g++-4.8 + - libgmp-dev + - libmpfr-dev + - libedit-dev + #- libboost1.55-dev + #- libboost-test1.55-dev + #- libboost-regex1.55-dev + #- libboost-python1.55-dev + #- libboost-system1.55-dev + #- libboost-date-time1.55-dev + #- libboost-iostreams1.55-dev + #- libboost-filesystem1.55-dev + #- libboost-serialization1.55-dev + +before_install: + - if [ "${TRAVIS_BRANCH}" = "master" ]; then export BOOST_VERSION="${BOOST_VERSION_MIN}"; else export BOOST_VERSION="${BOOST_VERSION_MAX}"; fi + - if [ -n "${BOOST_VERSION}" ]; then export BOOST_ROOT="${TRAVIS_BUILD_DIR}/../boost-trunk"; export CMAKE_MODULE_PATH="${BOOST_ROOT}"; fi + - if [ "${CXX}" = "g++" ]; then export CXX="$(which g++-4.8)"; export CC="$(which gcc-4.8)"; fi + - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then export DYLD_LIBRARY_PATH="${BOOST_ROOT}/lib"; fi + # c++ is a symlink to clang++, but the compiler behaves differently when invoked as c++ + - if [ "${TRAVIS_OS_NAME}" = "osx" -a "${CXX}" = "clang++" ]; then export CXX="$(which c++)"; export CC="$(which cc)"; fi + - tools/travis-before_install.sh + +install: + - tools/travis-install.sh + +before_script: + - cmake . -DUSE_PYTHON=ON -DBUILD_DEBUG=ON + - make + +script: + - make test + - PYTHONPATH=. python python/demo.py + +after_script: + # These scripts are run for informational purposes and + # should be reintegrated into CTest once they reliably verify the documentation. + - python test/CheckTexinfo.py -l ledger -s . + - python test/CheckManpage.py -l ledger -s . + +notifications: + email: + on_success: change + on_failure: change + irc: + channels: [ "chat.freenode.net#ledger" ] + on_success: change + on_failure: change diff --git a/CMakeLists.txt b/CMakeLists.txt index fc2ef2bb..ca82084e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,23 @@ cmake_minimum_required(VERSION 2.8.5) +if(POLICY CMP0042) + # CMP0042 is only known to CMake 3.0 and above + cmake_policy(SET CMP0042 OLD) +endif(POLICY CMP0042) PROJECT(ledger) set(Ledger_VERSION_MAJOR 3) -set(Ledger_VERSION_MINOR 0) +set(Ledger_VERSION_MINOR 1) set(Ledger_VERSION_PATCH 0) -set(Ledger_VERSION_DATE 20130529) +set(Ledger_VERSION_DATE 20141005) enable_testing() +add_definitions(-std=c++11) +if (CYGWIN) + add_definitions(-U__STRICT_ANSI__) +endif() + ######################################################################## option(USE_PYTHON "Build support for the Python scripting bridge" OFF) @@ -18,11 +27,11 @@ 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) -if(BUILD_DEBUG) +if (BUILD_DEBUG) set(CMAKE_BUILD_TYPE Debug) set(DEBUG_MODE 1) else() @@ -30,25 +39,29 @@ else() set(DEBUG_MODE 0) endif() -if(DISABLE_ASSERTS) +if (DISABLE_ASSERTS) set(NO_ASSERTS 1) else() set(NO_ASSERTS 0) endif() -if(CLANG_GCOV) +if (CLANG_GCOV) set(PROFILE_LIBS profile_rt) set(CMAKE_REQUIRED_LIBRARIES ${PROFILE_LIBS}) endif() ######################################################################## +set(Python_ADDITIONAL_VERSIONS 2.7 2.6) find_package(PythonInterp) # Used for running tests -if(USE_PYTHON) - set(Python_ADDITIONAL_VERSIONS 2.7 2.6) +if (USE_PYTHON) + if (NOT BUILD_LIBRARY) + message(ERROR "Building the python module requires BUILD_LIBRARY=ON.") + endif() + find_package(PythonLibs) - if(PYTHONLIBS_FOUND) + if (PYTHONLIBS_FOUND) set(BOOST_PYTHON python) set(HAVE_BOOST_PYTHON 1) include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS}) @@ -61,7 +74,7 @@ else() endif() # Set BOOST_ROOT to help CMake to find the right Boost version -find_package(Boost 1.46.0 +find_package(Boost 1.49.0 REQUIRED date_time filesystem system iostreams regex unit_test_framework ${BOOST_PYTHON}) @@ -81,6 +94,7 @@ check_function_exists(access HAVE_ACCESS) check_function_exists(realpath HAVE_REALPATH) check_function_exists(getpwuid HAVE_GETPWUID) check_function_exists(getpwnam HAVE_GETPWNAM) +check_function_exists(ioctl HAVE_IOCTL) check_function_exists(isatty HAVE_ISATTY) check_c_source_compiles(" @@ -114,7 +128,7 @@ int main() { return 0; }" UNIX_PIPES_COMPILES) -if(UNIX_PIPES_COMPILES) +if (UNIX_PIPES_COMPILES) set(HAVE_UNIX_PIPES 1) else() set(HAVE_UNIX_PIPES 0) @@ -136,7 +150,7 @@ int main() { return u32regex_search(text, r) ? 0 : 1; }" BOOST_REGEX_UNICODE_RUNS) -if(BOOST_REGEX_UNICODE_RUNS) +if (BOOST_REGEX_UNICODE_RUNS) set(HAVE_BOOST_REGEX_UNICODE 1) else() set(HAVE_BOOST_REGEX_UNICODE 0) @@ -144,49 +158,18 @@ endif() cmake_pop_check_state() -#cmake_push_check_state() -# -#set(CMAKE_REQUIRED_FLAGS -std=c++11) -#set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH}) -# -#check_cxx_source_runs(" -##include <regex> -##include <vector> -##include <iostream> -# -#int main() { -# std::vector<int> x {0, 1, 2, 3, 4}; -# for (auto i : x) -# std::cout << i << std::endl; -# -# std::regex r(\"foo\"); -# std::cout << std::regex_match(\"foobar\", r) << std::endl; -# return 0; -#}" CXX11_RUNS) -# -#cmake_pop_check_state() -# -#if(CXX11_RUNS) -# set(HAVE_CXX11 1) -# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -#else() - set(HAVE_CXX11 0) -#endif() -# -#cmake_pop_check_state() - ######################################################################## include_directories(${CMAKE_INCLUDE_PATH}) macro(find_opt_library_and_header _header_var _header _lib_var _lib _have_var) - if(${_have_var}) + if (${_have_var}) find_path(${_header_var} ${_header}) - if(NOT ${_header_var}) + if (NOT ${_header_var}) set(${_have_var} 0) else() find_library(${_lib_var} ${_lib}) - if(NOT ${_lib_var}) + if (NOT ${_lib_var}) set(${_have_var} 0) else() include_directories(SYSTEM "${${_header_var}}") @@ -200,12 +183,12 @@ endmacro(find_opt_library_and_header _header_var _header _lib_var _lib _have_var macro(find_req_library_and_header _header_var _header _lib_var _lib) find_path(${_header_var} ${_header}) - if(NOT ${_header_var}) + if (NOT ${_header_var}) message(SEND_ERROR "Could not find ${_header} on your system") else() include_directories(SYSTEM "${${_header_var}}") find_library(${_lib_var} ${_lib}) - if(NOT ${_lib_var}) + if (NOT ${_lib_var}) message(SEND_ERROR "Could not find library ${_lib} on your system") endif() endif() @@ -219,7 +202,7 @@ find_opt_library_and_header(EDIT_PATH histedit.h EDIT_LIB edit HAVE_EDIT) #find_package(Gettext) # Used for running tests -#if(GETTEXT_FOUND) +#if (GETTEXT_FOUND) # set(HAVE_GETTEXT 1) #else() set(HAVE_GETTEXT 0) @@ -232,23 +215,20 @@ find_opt_library_and_header(EDIT_PATH histedit.h EDIT_LIB edit HAVE_EDIT) ######################################################################## macro(add_ledger_library_dependencies _target) - if(BUILD_LIBRARY) - target_link_libraries(${_target} libledger) - endif() target_link_libraries(${_target} ${MPFR_LIB}) target_link_libraries(${_target} ${GMP_LIB}) - if(HAVE_EDIT) + if (HAVE_EDIT) target_link_libraries(${_target} ${EDIT_LIB}) endif() - if(HAVE_GETTEXT) + if (HAVE_GETTEXT) target_link_libraries(${_target} ${INTL_LIB}) endif() - if(HAVE_BOOST_PYTHON) + if (HAVE_BOOST_PYTHON) target_link_libraries(${_target} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) else() target_link_libraries(${_target} ${Boost_LIBRARIES}) endif() - if(HAVE_BOOST_REGEX_UNICODE) + if (HAVE_BOOST_REGEX_UNICODE) target_link_libraries(${_target} icuuc) endif() target_link_libraries(${_target} ${PROFILE_LIBS}) @@ -269,7 +249,7 @@ configure_file( ${PROJECT_SOURCE_DIR}/src/system.hh.in ${PROJECT_BINARY_DIR}/system.hh) -if(CMAKE_CXX_COMPILER MATCHES "clang") +if (CMAKE_CXX_COMPILER MATCHES "clang") set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") elseif(CMAKE_CXX_COMPILER MATCHES "g\\+\\+") set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") @@ -277,7 +257,7 @@ endif() add_subdirectory(src) add_subdirectory(doc) -if(BUILD_EMACSLISP) +if (BUILD_EMACSLISP) add_subdirectory(lisp) endif() add_subdirectory(test) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..a4b8b14f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,8 @@ +Tips for contributors +--------------------- + +* Please **make pull requests against `next`, not `master`**. + Ledger follows a [git-flow](http://nvie.com/posts/a-successful-git-branching-model/) branching model, + in which development happens on the `next` branch and is subsequently merged into `master` for releases. +* If you're making **changes to `ledger-mode`, or other files for which the Travis build is not + relevant**, please **add `[ci skip]` to the end of the commit message**. @@ -54,19 +54,13 @@ it's usually fairly obvious where things have gone astray. GNU/Linux system (or Debian-based system such as Ubuntu), something like this should work (as root): - # aptitude update - # for name in \ - cmake libboost-dev libboost-date-time-dev libboost-doc \ - libboost-dbg libboost-filesystem-dev libboost-graph-dev \ - libboost-iostreams-dev libboost-program-options-dev \ - libboost-python-dev libboost-regex-dev \ - libboost-serialization-dev libboost-signals-dev \ - libboost-test-dev libboost-thread-dev libboost-wave-dev \ - libmpfr-dev libmpfr-dbg libmpfr-doc; \ - do \ - aptitude install ${name}; \ - done - + sudo apt-get install build-essential cmake texinfo python-dev \ + zlib1g-dev libbz2-dev libgmp3-dev gettext libmpfr-dev \ + libboost-date-time-dev libboost-filesystem-dev \ + libboost-graph-dev libboost-iostreams-dev \ + libboost-python-dev libboost-regex-dev libboost-test-dev \ + doxygen libedit-dev libmpc-dev + ---------------------------------------------------------------------- - Q: Configure fails saying it can't find boost_regex @@ -1,3 +1,5 @@ +[](https://travis-ci.org/ledger/ledger) + # Ledger: Command-Line Accounting Ledger is a powerful, double-entry accounting system that is accessed from the @@ -5,6 +7,15 @@ UNIX command-line. This may put off some users, since there is no flashy UI, but for those who want unparalleled reporting access to their data there are few alternatives. +Ledger uses text files for input. It reads the files and generates reports; +there is no other database or stored state. To use Ledger, you create a +file of your account names and transactions, run from the command line with +some options to specify input and requested reports, and get output. +The output is generally plain text, though you could generate a graph or +html instead. Ledger is simple in concept, surprisingly rich in ability, +and easy to use. + + ## For the Impatient I know, you just want to build and play. If you have all the dependencies @@ -17,6 +28,13 @@ Now try your first ledger command: ./ledger -f test/input/sample.dat reg +For help on keeping your journal have a look at the +[documentation](http://www.ledger-cli.org/docs.html) and the +[wiki](http://wiki.ledger-cli.org/) (Also see the “Resources” section at the +end of this file). An emacs mode for ledger files can be found in the `lisp` +directory and a vim plugin is located in the [ledger/vim-ledger +repository](https://github.com/ledger/vim-ledger). + ## To the Rest If you're reading this file, you have in your hands the Bleeding Edge. This @@ -30,7 +48,7 @@ major bugs that you find. Just e-mail me, or post to the mailing list, they'll become a part of my work list. <table> -<tr><td><strong>RELEASE</strong></td><td><tt>git checkout v2.6.3</tt></td></tr> +<tr><td><strong>RELEASE</strong></td><td><tt>git checkout v3.1</tt></td></tr> <tr><td><strong>CURRENT</strong></td><td><tt>git checkout maint</tt></td></tr> <tr><td><strong>BETA</strong></td><td><tt>git checkout -b master origin/master</tt></td></tr> <tr><td><strong>ALPHA</strong></td><td><tt>git checkout -b next origin/next</tt></td></tr> @@ -45,7 +63,8 @@ much further with those. ## Dependencies If you wish to proceed in this venture, you'll need a few dependencies. The -easiest way to get them for your platform is to run: +easiest way to get them for your platform is to run this handy Python +script: ./acprep dependencies @@ -56,6 +75,7 @@ current `master` branch: <tr><td>Boost</td><td>1.35</td><td></td></tr> <tr><td>GMP</td><td>4.2.2</td><td></td></tr> <tr><td>MPFR</td><td>2.4.0</td><td></td></tr> +<tr><td>utfcpp</td><td>2.3.4</td><td></td></tr> <tr><td>gettext</td><td>0.17</td><td><em>optional</em></td></tr> <tr><td>libedit</td><td>20090111-3.0</td><td><em>optional</em></td></tr> <tr><td>Python</td><td>2.4</td><td><em>optional</em></td></tr> @@ -76,50 +96,70 @@ And for building the current `maint` branch: <tr><td>libxml2</td><td>2.7.2</td><td><em>optional</em></td></tr> </table> -### MacPorts +### OS X + +You can use [MacPorts](https://www.macports.org/) or [homebrew](http://brew.sh/) to install this very quickly on OS X. + +#### 1. Homebrew + +You can see the parameters you can pass while installing with brew by the command `brew options ledger`. To install ledger, simply type the following command: + + brew install ledger + +If everything worked well, you should have ledger working now. If you want to install this with python bindings, you can use the following command: + + brew install ledger --with-python + +If you to want to startup python, use the following command: + + ledger python + + +#### 2. MacPorts If you build stuff using MacPorts on OS X, as I do, here is what you would run: - sudo port install -f cmake python26 - libiconv +universal zlib +universal gmp +universal - mpfr +universal ncurses +universal ncursesw +universal - gettext +universal libedit +universal boost-jam - boost +st+python26+icu texlive doxygen graphviz - texinfo lcov sloccount + sudo port install -f cmake python26 \ + libiconv +universal zlib +universal gmp +universal \ + mpfr +universal ncurses +universal ncursesw +universal \ + gettext +universal libedit +universal boost-jam \ + boost +st+python26+icu texlive doxygen graphviz \ + texinfo lcov sloccount ### Ubuntu If you're going to build on Ubuntu, `sudo apt-get install ...` the -following packages (current as of Ubuntu 12.04): +following packages (current as of Ubuntu 14.04): - sudo apt-get install build-essential cmake zlib1g-dev libbz2-dev - python-dev gettext libgmp3-dev libmpfr-dev libboost-dev - libboost-regex-dev libboost-date-time-dev - libboost-filesystem-dev libboost-python-dev texinfo lcov - sloccount libboost-iostreams-dev libboost-test-dev + sudo apt-get install build-essential cmake doxygen \ + libboost-system-dev libboost-dev python-dev gettext git \ + libboost-date-time-dev libboost-filesystem-dev \ + libboost-iostreams-dev libboost-python-dev libboost-regex-dev \ + libboost-test-dev libedit-dev libgmp3-dev libmpfr-dev texinfo -Or, for Ubuntu Karmic: +Or, for Ubuntu 12.04: - sudo apt-get install build-essential cmake texinfo python-dev zlib1g-dev - libbz2-dev libgmp3-dev bjam gettext cvs libboost1.40-dev - libboost-regex1.40-dev libboost-date-time1.40-dev - libboost-filesystem1.40-dev libmpfr-dev + sudo apt-get install build-essential cmake zlib1g-dev libbz2-dev \ + python-dev gettext libgmp3-dev libmpfr-dev libboost-dev \ + libboost-regex-dev libboost-date-time-dev \ + libboost-filesystem-dev libboost-python-dev texinfo lcov \ + sloccount libboost-iostreams-dev libboost-test-dev ### Debian Debian squeeze (6.0): the version of boost in squeeze is too old for ledger and unfortunately no backport is available at the moment. -Debian wheezy (7.0) contains all components needed to build ledger. -You can install all required build dependencies using the following -command: +Debian 7 (wheezy) and Debian 8 (jessie) contain all components needed to +build ledger. You can install all required build dependencies using the +following command: - sudo apt-get install build-essential cmake autopoint texinfo python-dev - zlib1g-dev libbz2-dev libgmp3-dev gettext libmpfr-dev - libboost-date-time1.49-dev libboost-filesystem1.49-dev - libboost-graph1.49-dev libboost-iostreams1.49-dev - libboost-python1.49-dev libboost-regex1.49-dev libboost-test1.49-dev + sudo apt-get install build-essential cmake autopoint texinfo python-dev \ + zlib1g-dev libbz2-dev libgmp3-dev gettext libmpfr-dev \ + libboost-date-time-dev libboost-filesystem-dev \ + libboost-graph-dev libboost-iostreams-dev \ + libboost-python-dev libboost-regex-dev libboost-test-dev ## Building @@ -144,6 +184,7 @@ You can run `make check` to confirm the result, and `make install` to install. Now that you're up and running, here are a few resources to keep in mind: - [Home page](http://ledger-cli.org) + - [Documentation](http://www.ledger-cli.org/docs.html) - [IRC channel](irc://irc.freenode.net/ledger) - [Mailing List / Forum](http://groups.google.com/group/ledger-cli) - [GitHub project page](http://github.com/ledger/ledger) @@ -1,10 +1,7 @@ #!/usr/bin/env python -# acprep, version 3.0 +# acprep, version 3.1 # -# This script configures my ledger source tree on my Mac OS/X machine. This -# is not necessary, however, since I keep all the files necessary for building -# checked in to the source tree. Users can just type './configure && make'. # This script simply sets up the compiler and linker flags for all the various # build permutations I use for testing and profiling. @@ -36,8 +33,6 @@ LEVELS = {'DEBUG': logging.DEBUG, 'ERROR': logging.ERROR, 'CRITICAL': logging.CRITICAL} -search_prefixes = [ '/usr/local', '/opt/local', '/sw', '/usr' ] - def which(program): def is_exe(fpath): return os.path.exists(fpath) and os.access(fpath, os.X_OK) @@ -61,37 +56,44 @@ def which(program): return None class BoostInfo(object): - def dependencies(system): - if system == 'darwin': + def dependencies(self, system): + if system == 'darwin-homebrew': + return [ 'boost' ] + + if system == 'darwin-macports': return [ 'boost-jam', 'boost', '+python27+universal' ] if system == 'centos': return [ 'boost-devel' ] - elif system == 'ubuntu-lucid': - return [ 'bjam', 'autopoint', - 'libboost-dev', - 'libboost-regex-dev', + elif system == 'ubuntu-trusty': + return [ 'libboost-dev', 'libboost-date-time-dev', 'libboost-filesystem-dev', 'libboost-iostreams-dev', - 'libboost-python-dev' ] + 'libboost-python-dev', + 'libboost-regex-dev', + 'libboost-system-dev', + 'libboost-test-dev' ] - elif system == 'ubuntu-karmic' or system == 'ubuntu-hardy': - return [ 'bjam', 'libboost-dev', + elif system == 'ubuntu-saucy' or system == 'ubuntu-precise': + return [ 'autopoint', + 'libboost-dev', + 'libboost-test-dev', 'libboost-regex-dev', 'libboost-date-time-dev', 'libboost-filesystem-dev', 'libboost-iostreams-dev', 'libboost-python-dev' ] - elif system == 'ubuntu-oneiric': - return [ 'libboost-dev', - 'libboost-python-dev', + elif system == 'ubuntu-lucid': + return [ 'bjam', 'autopoint', + 'libboost-dev', 'libboost-regex-dev', 'libboost-date-time-dev', 'libboost-filesystem-dev', - 'libboost-iostreams-dev' ] + 'libboost-iostreams-dev', + 'libboost-python-dev' ] class CommandLineApp(object): @@ -526,7 +528,16 @@ class PrepareBuild(CommandLineApp): 'libedit' ,'+universal', 'texlive-xetex', 'doxygen', 'graphviz', 'texinfo', 'lcov', 'sloccount' - ] + BoostInfo.dependencies('darwin') + ] + BoostInfo().dependencies('darwin-macports') + self.log.info('Executing: ' + ' '.join(packages)) + self.execute(*packages) + elif exists('/usr/local/bin/brew') or exists('/opt/local/bin/brew'): + self.log.info('Looks like you are using Homebrew on OS X') + packages = [ + 'brew', 'install', + 'cmake', 'ninja', + 'mpfr', 'gmp', + ] + BoostInfo().dependencies('darwin-homebrew') self.log.info('Executing: ' + ' '.join(packages)) self.execute(*packages) elif exists('/sw/bin/fink'): @@ -541,77 +552,62 @@ class PrepareBuild(CommandLineApp): release = open('/etc/lsb-release') info = release.read() release.close() - if re.search('karmic', info): - self.log.info('Looks like you are using APT on Ubuntu Karmic') + if re.search('trusty', info): + self.log.info('Looks like you are using APT on Ubuntu Trusty') packages = [ 'sudo', 'apt-get', 'install', 'build-essential', - 'libtool', - 'autoconf', - 'automake', + 'doxygen', + 'cmake', + 'ninja-build', 'zlib1g-dev', 'libbz2-dev', 'python-dev', 'libgmp3-dev', 'libmpfr-dev', 'gettext', - 'cvs', 'libedit-dev', - #'texlive-full', - #'doxygen', - #'graphviz', 'texinfo', 'lcov', 'sloccount' - ] + BoostInfo.dependencies('ubuntu-karmic') - elif re.search('hardy', info): - self.log.info('Looks like you are using APT on Ubuntu Hardy') + ] + BoostInfo().dependencies('ubuntu-trusty') + elif re.search('saucy', info): + self.log.info('Looks like you are using APT on Ubuntu Saucy') packages = [ 'sudo', 'apt-get', 'install', 'build-essential', 'libtool', - 'autoconf', - 'automake', - 'autopoint', + 'cmake', + 'ninja-build', 'zlib1g-dev', 'libbz2-dev', 'python-dev', - 'cvs', - 'gettext', - 'libgmp3-dev', + 'libgmp-dev', 'libmpfr-dev', + 'gettext', 'libedit-dev', - #'texlive-full', - #'doxygen', - #'graphviz', 'texinfo', 'lcov', 'sloccount' - ] + self.boost_info.dependencies('ubuntu-hardy') - elif re.search('oneiric', info): - self.log.info('Looks like you are using APT on Ubuntu Oneiric') + ] + BoostInfo().dependencies('ubuntu-saucy') + elif re.search('precise', info): + self.log.info('Looks like you are using APT on Ubuntu Precise') packages = [ 'sudo', 'apt-get', 'install', 'build-essential', 'libtool', - 'autoconf', - 'automake', - 'autopoint', + 'cmake', 'zlib1g-dev', 'libbz2-dev', 'python-dev', - 'cvs', - 'gettext', - 'libgmp3-dev', + 'libgmp-dev', 'libmpfr-dev', + 'gettext', 'libedit-dev', - #'texlive-full', - #'doxygen', - #'graphviz', 'texinfo', 'lcov', 'sloccount' - ] + self.boost_info.dependencies('ubuntu-oneiric') + ] + BoostInfo().dependencies('ubuntu-precise') else: self.log.info('I do not recognize your version of Ubuntu!') packages = None @@ -648,6 +644,9 @@ class PrepareBuild(CommandLineApp): ] self.log.info('Executing: ' + ' '.join(packages)) self.execute(*packages) + elif system.startswith('CYGWIN'): + self.log.info('Looks like you are using Cygwin') + self.log.info('Please install the dependencies manually.') ######################################################################### # Determine the system's basic configuration # @@ -686,7 +685,10 @@ class PrepareBuild(CommandLineApp): if self.options.python: self.configure_args.append('-DUSE_PYTHON=1') - if self.options.use_ninja: + if system.startswith('CYGWIN'): + self.configure_args.append('-G') + self.configure_args.append('Unix Makefiles') + elif self.options.use_ninja: self.configure_args.append('-GNinja') if exists('/Users/johnw/Projects/ledger/plan/TODO'): @@ -764,7 +766,7 @@ class PrepareBuild(CommandLineApp): self.LDFLAGS.append('-ftest-coverage') if not self.options.compiler or self.options.compiler == "clang-3.1": - self.LDFLAGS.append('-lprofile_rt') + self.LDFLAGS.append('-lgcov') def setup_flavor_gprof(self): self.configure_args.append('-DBUILD_DEBUG=1') @@ -803,12 +805,13 @@ class PrepareBuild(CommandLineApp): conf_args.append('-DCMAKE_CXX_FLAGS=%s' % self.envvars[var]) elif var == 'LDFLAGS': - conf_args.append('-DCMAKE_EXE_LINKER_FLAGS=%s' % + conf_args.append('-DCMAKE_EXE_LINKER_FLAGS=%s' % self.envvars[var]) if self.options.boost_root: conf_args.append('-DBOOST_ROOT=%s' % self.options.boost_root) + conf_args.append('-DBoost_NO_SYSTEM_PATHS=TRUE') if self.options.boost_suffix: conf_args.append('-DBoost_COMPILER=%s' % self.options.boost_suffix) @@ -882,7 +885,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)) @@ -895,13 +898,13 @@ class PrepareBuild(CommandLineApp): self.log.debug('Changing directory to ' + build_dir) os.chdir(build_dir) - self.execute(*(['ninja' if self.options.use_ninja else 'make'] + + self.execute(*(['ninja' if self.options.use_ninja else 'make'] + make_args)) finally: os.chdir(self.source_dir) def phase_check(self, *args): - self.log.info('Executing phase: update') + self.log.info('Executing phase: check') build_dir = self.ensure(self.build_directory()) try: self.log.debug('Changing directory to ' + build_dir) diff --git a/contrib/ParseCcStmt.cs b/contrib/ParseCcStmt.cs index c9ad1d55..04e3dbb9 100644 --- a/contrib/ParseCcStmt.cs +++ b/contrib/ParseCcStmt.cs @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2008, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are 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/contrib/ledger-completion.bash b/contrib/ledger-completion.bash index 8f3e16af..d46b712d 100644 --- a/contrib/ledger-completion.bash +++ b/contrib/ledger-completion.bash @@ -43,7 +43,7 @@ _ledger() # report.cc::lookup_option # session.cc::lookup_option # - options="--abbrev-len= --account-width= --account= --actual --actual-dates --add-budget --amount-data --amount-width= --amount= --anon --ansi --args-only --auto-match --aux-date --average --balance-format= --base --basis --begin= --bold-if= --budget --budget-format= --by-payee --cache= --change --check-payees --cleared --cleared-format= --collapse --collapse-if-zero --color --columns= --cost --count --csv-format= --current --daily --date-format= --date-width= --date= --datetime-format= --day-break --days-of-week --dc --debug= --decimal-comma --depth= --detail --deviation --display-amount= --display-total= --display= --dow --download --effective --empty --end= --equity --exact --exchange= --explicit --file= --first= --flat --force-color --force-pager --forecast-years= --forecast= --format= --full-help --gain --generated --group-by= --group-title-format= --head= --help --help-calc --help-comm --help-disp --historical --immediate --init-file= --inject= --input-date-format= --invert --last= --leeway= --limit= --lot-dates --lot-notes --lot-prices --lot-tags --lots --lots-actual --market --master-account= --meta-width= --meta= --monthly --no-color --no-rounding --no-titles --no-total --now= --only= --options --output= --pager= --payee-width= --payee= --pedantic --pending --percent --period-sort= --period= --permissive --pivot= --plot-amount-format= --plot-total-format= --prepend-format= --prepend-width= --price --price-db= --price-exp= --pricedb-format= --prices-format= --primary-date --quantity --quarterly --raw --real --register-format= --related --related-all --revalued --revalued-only --revalued-total= --rich-data --script= --seed= --sort-all= --sort-xacts= --sort= --start-of-week= --strict --subtotal --tail= --time-colon --time-report --total-data --total-width= --total= --trace= --truncate= --unbudgeted --uncleared --unrealized --unrealized-gains= --unrealized-losses= --unround --value --value-expr= --values --verbose --verify --verify-memory --version --weekly --wide --yearly" + options="--abbrev-len= --account-width= --account= --actual --actual-dates --add-budget --amount-data --amount-width= --amount= --anon --ansi --args-only --auto-match --aux-date --average --balance-format= --base --basis --begin= --bold-if= --budget --budget-format= --by-payee --cache= --change --check-payees --cleared --cleared-format= --collapse --collapse-if-zero --color --columns= --cost --count --csv-format= --current --daily --date-format= --date-width= --date= --datetime-format= --day-break --days-of-week --dc --debug= --decimal-comma --depth= --detail --deviation --display-amount= --display-total= --display= --dow --download --effective --empty --end= --equity --exact --exchange= --explicit --file= --first= --flat --force-color --force-pager --forecast-while= --forecast-years= --forecast= --format= --full-help --gain --generated --group-by= --group-title-format= --head= --help --help-calc --help-comm --help-disp --historical --immediate --init-file= --inject= --input-date-format= --invert --last= --leeway= --limit= --lot-dates --lot-notes --lot-prices --lot-tags --lots --lots-actual --market --master-account= --meta-width= --meta= --monthly --no-aliases --no-color --no-pager --no-rounding --no-titles --no-total --now= --only= --options --output= --pager= --payee-width= --payee= --pedantic --pending --percent --period-sort= --period= --permissive --pivot= --plot-amount-format= --plot-total-format= --prepend-format= --prepend-width= --price --price-db= --price-exp= --pricedb-format= --prices-format= --primary-date --quantity --quarterly --raw --real --recursive-aliases --register-format= --related --related-all --revalued --revalued-only --revalued-total= --rich-data --script= --seed= --sort-all= --sort-xacts= --sort= --start-of-week= --strict --subtotal --tail= --time-colon --time-report --total-data --total-width= --total= --trace= --truncate= --unbudgeted --uncleared --unrealized --unrealized-gains= --unrealized-losses= --unround --value --value-expr= --values --verbose --verify --verify-memory --version --weekly --wide --yearly" # Bash FAQ E13 http://tiswww.case.edu/php/chet/bash/FAQ # diff --git a/contrib/vim/README b/contrib/vim/README deleted file mode 100644 index a3f5a877..00000000 --- a/contrib/vim/README +++ /dev/null @@ -1,89 +0,0 @@ - -This is the ledger filetype for vim. -Copy each file to the corresponding directory in your ~/.vim directory. -Then include the following line in your .vimrc or in ~/.vim/filetype.vim - au BufNewFile,BufRead *.ldg,*.ledger setf ledger | comp ledger -You can also use a modeline like this in every ledger file - vim:filetype=ledger - -Tips and useful commands -====================================================================== - • Try account-completion (as explained below) - • :call LedgerSetDate(line('.'), 'effective') - will set today's date as the effective date of the current - transaction. You can use also 'actual' in place of 'effective' - or pass in a different date measured as seconds since 1st Jan 1970. - • :call LedgerSetTransactionState(line('.'), '*') - sets the state of the current transaction to '*'. You can - use this in custom mappings. - • :call LedgerToggleTransactionState(line('.'), ' *?!') - will toggle through the provided transaction states. - You can map this to double-clicking for example: - noremap <silent><buffer> <2-LeftMouse> - \ :call LedgerToggleTransactionState(line('.'), ' *?!')<CR> - -Configuration -====================================================================== -Include the following let-statements somewhere in your .vimrc -to modify the behaviour of the ledger filetype. - -* Number of colums that will be used to display the foldtext. - Set this when you think that the amount is too far off to the right. - let g:ledger_maxwidth = 80 - -* String that will be used to fill the space between account name - and amount in the foldtext. Set this to get some kind of lines - or visual aid. - let g:ledger_fillstring = ' -' - My special tip is to use so-called digraphs: - Press <C-K> followed by the two-characters key sequence below. - (in insert-mode) - '. = ˙ or ': = ¨ --> ˙˙˙˙˙˙ or ¨¨¨¨¨¨ - ', = ¸ --> ¸¸¸¸¸¸ - .M = · --> ······ - >> = » --> »»»»»» - All those look rather unobstrusive - and provide a good visual aid to find the correct amount. - -* If you want the account completion to be sorted by level of detail/depth - instead of alphabetical, include the following line: - let g:ledger_detailed_first = 1 - -Completion -====================================================================== -Omni completion is currently implemented for account names only. - -Accounts ----------------------------------------------------------------------- -Account names are matched by the start of every sub-level. -When you insert an account name like this: - Asse<C-X><C-O> -You will get a list of top-level accounts that start like this. - -Go ahead and try something like: - As:Ban:Che<C-X><C-O> -When you have an account like this, 'Assets:Bank:Checking' should show up. - -When you want to complete on a virtual transaction, -it's currently best to keep the cursor in front of the closing bracket. -Of course you can insert the closing bracket after calling the completion, too. - -License -====================================================================== -Copyright 2011-2009 by Johann Klähn -Copyright 2009 by Stefan Karrmann -Copyright 2005 by Wolfgang Oertl - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. - diff --git a/contrib/vim/compiler/ledger.vim b/contrib/vim/compiler/ledger.vim deleted file mode 100644 index e9e98a8e..00000000 --- a/contrib/vim/compiler/ledger.vim +++ /dev/null @@ -1,28 +0,0 @@ -" Vim Compiler File -" Compiler: ledger -" by Johann Klähn; Use according to the terms of the GPL>=2. -" vim:ts=2:sw=2:sts=2:foldmethod=marker - -if exists("current_compiler") - finish -endif -let current_compiler = "ledger" - -if exists(":CompilerSet") != 2 - command -nargs=* CompilerSet setlocal <args> -endif - -" default value will be set in ftplugin -if ! exists("g:ledger_bin") || empty(g:ledger_bin) || ! executable(split(g:ledger_bin, '\s')[0]) - finish -endif - -" %-G throws away blank lines, everything else is assumed to be part of a -" multi-line error message. -CompilerSet errorformat=%-G,%EWhile\ parsing\ file\ \"%f\"\\,\ line\ %l:%.%#,%ZError:\ %m,%C%.%# -CompilerSet errorformat+=%tarning:\ \"%f\"\\,\ line\ %l:\ %m - -" unfortunately there is no 'check file' command, -" so we will just use a query that returns no results. ever. -exe 'CompilerSet makeprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ %\ reg\ not\ ''.*''\ \>\ /dev/null' - diff --git a/contrib/vim/ftplugin/ledger.vim b/contrib/vim/ftplugin/ledger.vim deleted file mode 100644 index 0067f9f8..00000000 --- a/contrib/vim/ftplugin/ledger.vim +++ /dev/null @@ -1,639 +0,0 @@ -" Vim filetype plugin file -" filetype: ledger -" by Johann Klähn; Use according to the terms of the GPL>=2. -" vim:ts=2:sw=2:sts=2:foldmethod=marker - -if exists("b:did_ftplugin") - finish -endif - -let b:did_ftplugin = 1 - -let b:undo_ftplugin = "setlocal ". - \ "foldmethod< foldtext< ". - \ "include< comments< commentstring< omnifunc< formatprg<" - -" don't fill fold lines --> cleaner look -setl fillchars="fold: " -setl foldtext=LedgerFoldText() -setl foldmethod=syntax -setl include=^!include -setl comments=b:; -setl commentstring=;%s -setl omnifunc=LedgerComplete - -" set location of ledger binary for checking and auto-formatting -if ! exists("g:ledger_bin") || empty(g:ledger_bin) || ! executable(split(g:ledger_bin, '\s')[0]) - if executable('ledger') - let g:ledger_bin = 'ledger' - else - unlet g:ledger_bin - echoerr "ledger command not found. Set g:ledger_bin or extend $PATH ". - \ "to enable error checking and auto-formatting." - endif -endif - -if exists("g:ledger_bin") - exe 'setl formatprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ -\ print' -endif - -" You can set a maximal number of columns the fold text (excluding amount) -" will use by overriding g:ledger_maxwidth in your .vimrc. -" When maxwidth is zero, the amount will be displayed at the far right side -" of the screen. -if !exists('g:ledger_maxwidth') - let g:ledger_maxwidth = 0 -endif - -if !exists('g:ledger_fillstring') - let g:ledger_fillstring = ' ' -endif - -" If enabled this will list the most detailed matches at the top {{{ -" of the completion list. -" For example when you have some accounts like this: -" A:Ba:Bu -" A:Bu:Bu -" and you complete on A:B:B normal behaviour may be the following -" A:B:B -" A:Bu:Bu -" A:Bu -" A:Ba:Bu -" A:Ba -" A -" with this option turned on it will be -" A:B:B -" A:Bu:Bu -" A:Ba:Bu -" A:Bu -" A:Ba -" A -" }}} -if !exists('g:ledger_detailed_first') - let g:ledger_detailed_first = 1 -endif - -" only display exact matches (no parent accounts etc.) -if !exists('g:ledger_exact_only') - let g:ledger_exact_only = 0 -endif - -" display original text / account name as completion -if !exists('g:ledger_include_original') - let g:ledger_include_original = 0 -endif - -let s:rx_amount = '\('. - \ '\%([0-9]\+\)'. - \ '\%([,.][0-9]\+\)*'. - \ '\|'. - \ '[,.][0-9]\+'. - \ '\)'. - \ '\s*\%([[:alpha:]¢$€£]\+\s*\)\?'. - \ '\%(\s*;.*\)\?$' - -function! LedgerFoldText() "{{{1 - " find amount - let amount = "" - let lnum = v:foldstart - while lnum <= v:foldend - let line = getline(lnum) - - " Skip metadata/leading comment - if line !~ '^\%(\s\+;\|\d\)' - " No comment, look for amount... - let groups = matchlist(line, s:rx_amount) - if ! empty(groups) - let amount = groups[1] - break - endif - endif - let lnum += 1 - endwhile - - let fmt = '%s %s ' - " strip whitespace at beginning and end of line - let foldtext = substitute(getline(v:foldstart), - \ '\(^\s\+\|\s\+$\)', '', 'g') - - " number of columns foldtext can use - let columns = s:get_columns() - if g:ledger_maxwidth - let columns = min([columns, g:ledger_maxwidth]) - endif - let columns -= s:multibyte_strlen(printf(fmt, '', amount)) - - " add spaces so the text is always long enough when we strip it - " to a certain width (fake table) - if strlen(g:ledger_fillstring) - " add extra spaces so fillstring aligns - let filen = s:multibyte_strlen(g:ledger_fillstring) - let folen = s:multibyte_strlen(foldtext) - let foldtext .= repeat(' ', filen - (folen%filen)) - - let foldtext .= repeat(g:ledger_fillstring, - \ s:get_columns()/filen) - else - let foldtext .= repeat(' ', s:get_columns()) - endif - - " we don't use slices[:5], because that messes up multibyte characters - let foldtext = substitute(foldtext, '.\{'.columns.'}\zs.*$', '', '') - - return printf(fmt, foldtext, amount) -endfunction "}}} - -function! LedgerComplete(findstart, base) "{{{1 - if a:findstart - let lnum = line('.') - let line = getline('.') - let b:compl_context = '' - if line =~ '^\s\+[^[:blank:];]' "{{{2 (account) - " only allow completion when in or at end of account name - if matchend(line, '^\s\+\%(\S \S\|\S\)\+') >= col('.') - 1 - " the start of the first non-blank character - " (excluding virtual-transaction and 'cleared' marks) - " is the beginning of the account name - let b:compl_context = 'account' - return matchend(line, '^\s\+[*!]\?\s*[\[(]\?') - endif - elseif line =~ '^\d' "{{{2 (description) - let pre = matchend(line, '^\d\S\+\%(([^)]*)\|[*?!]\|\s\)\+') - if pre < col('.') - 1 - let b:compl_context = 'description' - return pre - endif - elseif line =~ '^$' "{{{2 (new line) - let b:compl_context = 'new' - endif "}}} - return -1 - else - if ! exists('b:compl_cache') - let b:compl_cache = s:collect_completion_data() - let b:compl_cache['#'] = changenr() - endif - let update_cache = 0 - - let results = [] - if b:compl_context == 'account' "{{{2 (account) - let hierarchy = split(a:base, ':') - if a:base =~ ':$' - call add(hierarchy, '') - endif - - let results = LedgerFindInTree(b:compl_cache.accounts, hierarchy) - let exacts = filter(copy(results), 'v:val[1]') - - if len(exacts) < 1 - " update cache if we have no exact matches - let update_cache = 1 - endif - - if g:ledger_exact_only - let results = exacts - endif - - call map(results, 'v:val[0]') - - if g:ledger_detailed_first - let results = reverse(sort(results, 's:sort_accounts_by_depth')) - else - let results = sort(results) - endif - elseif b:compl_context == 'description' "{{{2 (description) - let results = s:filter_items(b:compl_cache.descriptions, a:base) - - if len(results) < 1 - let update_cache = 1 - endif - elseif b:compl_context == 'new' "{{{2 (new line) - return [strftime('%Y/%m/%d')] - endif "}}} - - - if g:ledger_include_original - call insert(results, a:base) - endif - - " no completion (apart from a:base) found. update cache if file has changed - if update_cache && b:compl_cache['#'] != changenr() - unlet b:compl_cache - return LedgerComplete(a:findstart, a:base) - else - unlet! b:compl_context - return results - endif - endif -endf "}}} - -function! LedgerFindInTree(tree, levels) "{{{1 - if empty(a:levels) - return [] - endif - let results = [] - let currentlvl = a:levels[0] - let nextlvls = a:levels[1:] - let branches = s:filter_items(keys(a:tree), currentlvl) - let exact = empty(nextlvls) - for branch in branches - call add(results, [branch, exact]) - if ! empty(nextlvls) - for [result, exact] in LedgerFindInTree(a:tree[branch], nextlvls) - call add(results, [branch.':'.result, exact]) - endfor - endif - endfor - return results -endf "}}} - -function! LedgerToggleTransactionState(lnum, ...) - if a:0 == 1 - let chars = a:1 - else - let chars = ' *' - endif - let trans = s:transaction.from_lnum(a:lnum) - if empty(trans) || has_key(trans, 'expr') - return - endif - - let old = has_key(trans, 'state') ? trans['state'] : ' ' - let i = stridx(chars, old) + 1 - let new = chars[i >= len(chars) ? 0 : i] - - call trans.set_state(new) - - call setline(trans['head'], trans.format_head()) -endf - -function! LedgerSetTransactionState(lnum, char) "{{{1 - " modifies or sets the state of the transaction at the cursor, - " removing the state alltogether if a:char is empty - let trans = s:transaction.from_lnum(a:lnum) - if empty(trans) || has_key(trans, 'expr') - return - endif - - call trans.set_state(a:char) - - call setline(trans['head'], trans.format_head()) -endf "}}} - -function! LedgerSetDate(lnum, type, ...) "{{{1 - let time = a:0 == 1 ? a:1 : localtime() - let trans = s:transaction.from_lnum(a:lnum) - if empty(trans) || has_key(trans, 'expr') - return - endif - - let formatted = strftime('%Y/%m/%d', time) - if has_key(trans, 'date') && ! empty(trans['date']) - let date = split(trans['date'], '=') - else - let date = [formatted] - endif - - if a:type ==? 'actual' - let date[0] = formatted - elseif a:type ==? 'effective' - if time < 0 - " remove effective date - let date = [date[0]] - else - " set effective date - if len(date) >= 2 - let date[1] = formatted - else - call add(date, formatted) - endif - endif - endif - - let trans['date'] = join(date, '=') - - call setline(trans['head'], trans.format_head()) -endf "}}} - -function! s:collect_completion_data() "{{{1 - let transactions = s:get_transactions() - let cache = {'descriptions': [], 'tags': {}, 'accounts': {}} - let accounts = [] - for xact in transactions - " collect descriptions - if has_key(xact, 'description') && index(cache.descriptions, xact['description']) < 0 - call add(cache.descriptions, xact['description']) - endif - let [t, postings] = xact.parse_body() - let tagdicts = [t] - - " collect account names - for posting in postings - if has_key(posting, 'tags') - call add(tagdicts, posting.tags) - endif - " remove virtual-transaction-marks - let name = substitute(posting.account, '\%(^\s*[\[(]\?\|[\])]\?\s*$\)', '', 'g') - if index(accounts, name) < 0 - call add(accounts, name) - endif - endfor - - " collect tags - for tags in tagdicts | for [tag, val] in items(tags) - let values = get(cache.tags, tag, []) - if index(values, val) < 0 - call add(values, val) - endif - let cache.tags[tag] = values - endfor | endfor - endfor - - for account in accounts - let last = cache.accounts - for part in split(account, ':') - let last[part] = get(last, part, {}) - let last = last[part] - endfor - endfor - - return cache -endf "}}} - -let s:transaction = {} "{{{1 -function! s:transaction.new() dict - return copy(s:transaction) -endf - -function! s:transaction.from_lnum(lnum) dict "{{{2 - let [head, tail] = s:get_transaction_extents(a:lnum) - if ! head - return {} - endif - - let trans = copy(s:transaction) - let trans['head'] = head - let trans['tail'] = tail - - " split off eventual comments at the end of line - let line = split(getline(head), '\ze\s*\%(\t\| \);', 1) - if len(line) > 1 - let trans['appendix'] = join(line[1:], '') - endif - - " parse rest of line - " FIXME (minor): will not preserve spacing (see 'join(parts)') - let parts = split(line[0], '\s\+') - if parts[0] ==# '~' - let trans['expr'] = join(parts[1:]) - return trans - elseif parts[0] ==# '=' - let trans['auto'] = join(parts[1:]) - return trans - elseif parts[0] !~ '^\d' - " this case is avoided in s:get_transaction_extents(), - " but we'll check anyway. - return {} - endif - - for part in parts - if ! has_key(trans, 'date') && part =~ '^\d' - let trans['date'] = part - elseif ! has_key(trans, 'code') && part =~ '^([^)]*)$' - let trans['code'] = part[1:-2] - elseif ! has_key(trans, 'state') && part =~ '^[[:punct:]]$' - " the first character by itself is assumed to be the state of the transaction. - let trans['state'] = part - else - " everything after date/code or state belongs to the description - break - endif - call remove(parts, 0) - endfor - - let trans['description'] = join(parts) - return trans -endf "}}} - -function! s:transaction.set_state(char) dict "{{{2 - if has_key(self, 'state') && a:char =~ '^\s*$' - call remove(self, 'state') - else - let self['state'] = a:char - endif -endf "}}} - -function! s:transaction.parse_body(...) dict "{{{2 - if a:0 == 2 - let head = a:1 - let tail = a:2 - elseif a:0 == 0 - let head = self['head'] - let tail = self['tail'] - else - throw "wrong number of arguments for parse_body()" - return [] - endif - - if ! head || tail <= head - return [] - endif - - let lnum = head - let tags = {} - let postings = [] - while lnum <= tail - let line = split(getline(lnum), '\s*\%(\t\| \);', 1) - - if line[0] =~ '^\s\+[^[:blank:];]' - " posting - let [state, rest] = matchlist(line[0], '^\s\+\([*!]\?\)\s*\(.*\)$')[1:2] - if rest =~ '\t\| ' - let [account, amount] = matchlist(rest, '^\(.\{-}\)\%(\t\| \)\s*\(.\{-}\)\s*$')[1:2] - else - let amount = '' - let account = matchstr(rest, '^\s*\zs.\{-}\ze\s*$') - endif - call add(postings, {'account': account, 'amount': amount, 'state': state}) - end - - " where are tags to be stored? - if empty(postings) - " they belong to the transaction - let tag_container = tags - else - " they belong to last posting - if ! has_key(postings[-1], 'tags') - let postings[-1]['tags'] = {} - endif - let tag_container = postings[-1]['tags'] - endif - - let comment = join(line[1:], ' ;') - if comment =~ '^\s*:' - " tags without values - for t in s:findall(comment, ':\zs[^:[:blank:]]\([^:]*[^:[:blank:]]\)\?\ze:') - let tag_container[t] = '' - endfor - elseif comment =~ '^\s*[^:[:blank:]][^:]\+:' - " tag with value - let key = matchstr(comment, '^\s*\zs[^:]\+\ze:') - if ! empty(key) - let val = matchstr(comment, ':\s*\zs.*\ze\s*$') - let tag_container[key] = val - endif - endif - let lnum += 1 - endw - return [tags, postings] -endf "}}} - -function! s:transaction.format_head() dict "{{{2 - if has_key(self, 'expr') - return '~ '.self['expr'] - elseif has_key(self, 'auto') - return '= '.self['auto'] - endif - - let parts = [] - if has_key(self, 'date') | call add(parts, self['date']) | endif - if has_key(self, 'code') | call add(parts, '('.self['code'].')') | endif - if has_key(self, 'state') | call add(parts, self['state']) | endif - if has_key(self, 'description') | call add(parts, self['description']) | endif - - let line = join(parts) - if has_key(self, 'appendix') | let line .= self['appendix'] | endif - - return line -endf "}}} -"}}} - -" Helper functions {{{1 - -function! s:get_transactions(...) "{{{2 - if a:0 == 2 - let lnum = a:1 - let end = a:2 - elseif a:0 == 0 - let lnum = 1 - let end = line('$') - else - throw "wrong number of arguments for get_transactions()" - return [] - endif - - " safe view / position - let view = winsaveview() - let fe = &foldenable - set nofoldenable - - let transactions = [] - call cursor(lnum, 0) - while lnum && lnum <= end - let trans = s:transaction.from_lnum(lnum) - if ! empty(trans) - call add(transactions, trans) - call cursor(trans['tail'], 0) - endif - let lnum = search('^[~=[:digit:]]', 'cW') - endw - - " restore view / position - let &foldenable = fe - call winrestview(view) - - return transactions -endf "}}} - -function! s:get_transaction_extents(lnum) "{{{2 - if ! (indent(a:lnum) || getline(a:lnum) =~ '^[~=[:digit:]]') - " only do something if lnum is in a transaction - return [0, 0] - endif - - " safe view / position - let view = winsaveview() - let fe = &foldenable - set nofoldenable - - call cursor(a:lnum, 0) - let head = search('^[~=[:digit:]]', 'bcnW') - let tail = search('^[^;[:blank:]]\S\+', 'nW') - let tail = tail > head ? tail - 1 : line('$') - - " restore view / position - let &foldenable = fe - call winrestview(view) - - return head ? [head, tail] : [0, 0] -endf "}}} - -function! s:findall(text, rx) " {{{2 - " returns all the matches in a string, - " there will be overlapping matches according to :help match() - let matches = [] - - while 1 - let m = matchstr(a:text, a:rx, 0, len(matches)+1) - if empty(m) - break - endif - - call add(matches, m) - endw - - return matches -endf "}}} - -" return length of string with fix for multibyte characters -function! s:multibyte_strlen(text) "{{{2 - return strlen(substitute(a:text, ".", "x", "g")) -endfunction "}}} - -" get # of visible/usable columns in current window -function! s:get_columns() " {{{2 - " As long as vim doesn't provide a command natively, - " we have to compute the available columns. - " see :help todo.txt -> /Add argument to winwidth()/ - - let columns = (winwidth(0) == 0 ? 80 : winwidth(0)) - &foldcolumn - if &number - " line('w$') is the line number of the last line - let columns -= max([len(line('w$'))+1, &numberwidth]) - endif - - " are there any signs/is the sign column displayed? - redir => signs - silent execute 'sign place buffer='.string(bufnr("%")) - redir END - if signs =~# 'id=' - let columns -= 2 - endif - - return columns -endf "}}} - -" remove spaces at start and end of string -function! s:strip_spaces(text) "{{{2 - return matchstr(a:text, '^\s*\zs\S\%(.*\S\)\?\ze\s*$') -endf "}}} - -" return only those items that start with a specified keyword -function! s:filter_items(list, keyword) "{{{2 - return filter(copy(a:list), 'v:val =~ ''^\V'.substitute(a:keyword, '\\', '\\\\', 'g').'''') -endf "}}} - -" return all lines matching an expression, returning only the matched part -function! s:grep_buffer(expression) "{{{2 - let lines = map(getline(1, '$'), 'matchstr(v:val, '''.a:expression.''')') - return filter(lines, 'v:val != ""') -endf "}}} - -function! s:sort_accounts_by_depth(name1, name2) "{{{2 - let depth1 = s:count_expression(a:name1, ':') - let depth2 = s:count_expression(a:name2, ':') - return depth1 == depth2 ? 0 : depth1 > depth2 ? 1 : -1 -endf "}}} - -function! s:count_expression(text, expression) "{{{2 - return len(split(a:text, a:expression, 1))-1 -endf "}}} diff --git a/contrib/vim/indent/ledger.vim b/contrib/vim/indent/ledger.vim deleted file mode 100644 index ce5d508d..00000000 --- a/contrib/vim/indent/ledger.vim +++ /dev/null @@ -1,46 +0,0 @@ -" Vim filetype indent file -" filetype: ledger -" by Johann Klähn; Use according to the terms of the GPL>=2. -" vim:ts=2:sw=2:sts=2:foldmethod=marker - -if exists("b:did_indent") - finish -endif -let b:did_indent = 1 - -setl autoindent -setl indentexpr=GetLedgerIndent() - -if exists("*GetLedgerIndent") - finish -endif - -function GetLedgerIndent(...) - " You can pass in a line number when calling this function manually. - let lnum = a:0 > 0 ? a:1 : v:lnum - " If this line is empty look at (the indentation of) the last line. - " Note that inside of a transaction no blank lines are allowed. - let line = getline(lnum) - let prev = getline(lnum - 1) - - if line =~ '^\s\+\S' - " Lines that already are indented (→postings, sub-directives) keep their indentation. - return &sw - elseif line =~ '^\s*$' - " Current line is empty, try to guess its type based on the previous line. - if prev =~ '^\([[:digit:]~=]\|\s\+\S\)' - " This is very likely a posting or a sub-directive. - " While lines following the start of a transaction are automatically - " indented you will have to indent the first line following a - " pre-declaration manually. This makes it easier to type long lists of - " 'account' pre-declarations without sub-directives, for example. - return &sw - else - return 0 - endif - else - " Everything else is not indented: - " start of transactions, pre-declarations, apply/end-lines - return 0 - endif -endf diff --git a/contrib/vim/syntax/ledger.vim b/contrib/vim/syntax/ledger.vim deleted file mode 100644 index c516bab0..00000000 --- a/contrib/vim/syntax/ledger.vim +++ /dev/null @@ -1,69 +0,0 @@ -" Vim syntax file -" filetype: ledger -" by Johann Klähn; Use according to the terms of the GPL>=2. -" by Stefan Karrmann; Use according to the terms of the GPL>=2. -" by Wolfgang Oertl; Use according to the terms of the GPL>=2. -" vim:ts=2:sw=2:sts=2:foldmethod=marker - -if version < 600 - syntax clear -elseif exists("b:current_sytax") - finish -endif - -" for debugging -syntax clear - -" DATE[=EDATE] [*|!] [(CODE)] DESC <-- first line of transaction -" ACCOUNT AMOUNT [; NOTE] <-- posting - -syn region ledgerTransaction start=/^[[:digit:]~=]/ skip=/^\s/ end=/^/ - \ fold keepend transparent - \ contains=ledgerTransactionDate,ledgerMetadata,ledgerPosting,ledgerTransactionExpression -syn match ledgerTransactionDate /^\d\S\+/ contained -syn match ledgerTransactionExpression /^[=~]\s\+\zs.*/ contained -syn match ledgerPosting /^\s\+[^[:blank:];][^;]*\ze\%($\|;\)/ - \ contained transparent contains=ledgerAccount,ledgerMetadata -" every space in an account name shall be surrounded by two non-spaces -" every account name ends with a tab, two spaces or the end of the line -syn match ledgerAccount /^\s\+\zs\%(\S\@<= \S\|\S\)\+\ze\%( \|\t\|\s*$\)/ contained - -syn region ledgerPreDeclaration start=/^\(account\|payee\|commodity\|tag\)/ skip=/^\s/ end=/^/ - \ keepend transparent - \ contains=ledgerPreDeclarationType,ledgerPreDeclarationName,ledgerPreDeclarationDirective -syn match ledgerPreDeclarationType /^\(account\|payee\|commodity\|tag\)/ contained -syn match ledgerPreDeclarationName /^\S\+\s\+\zs.*/ contained -syn match ledgerPreDeclarationDirective /^\s\+\zs\S\+/ contained - -syn match ledgerComment /^;.*$/ -" comments at eol must be preceeded by at least 2 spaces / 1 tab -syn region ledgerMetadata start=/\%( \|\t\|^\s\+\);/ skip=/^\s\+;/ end=/^/ - \ keepend contained contains=ledgerTag,ledgerTypedTag -syn match ledgerTag /:[^:]\+:/hs=s+1,he=e-1 contained -syn match ledgerTag /\%(\%(;\|^tag\)[^:]\+\)\@<=[^:]\+:\ze[^:]\+$/ contained -syn match ledgerTypedTag /\%(\%(;\|^tag\)[^:]\+\)\@<=[^:]\+::\ze[^:]\+$/ contained - -syn region ledgerApply - \ matchgroup=ledgerStartApply start=/^apply\>/ - \ matchgroup=ledgerEndApply end=/^end\s\+apply\>/ - \ contains=ledgerApplyHead,ledgerApply,ledgerTransaction,ledgerComment -syn match ledgerApplyHead /\%(^apply\s\+\)\@<=\S.*$/ contained - -highlight default link ledgerTransactionDate Constant -highlight default link ledgerTransactionExpression Statement -highlight default link ledgerMetadata Tag -highlight default link ledgerTypedTag Keyword -highlight default link ledgerTag Type -highlight default link ledgerStartApply Tag -highlight default link ledgerEndApply Tag -highlight default link ledgerApplyHead Type -highlight default link ledgerAccount Identifier -highlight default link ledgerPreDeclarationType Type -highlight default link ledgerPreDeclarationName Identifier -highlight default link ledgerPreDeclarationDirective Type - -" syncinc is easy: search for the first transaction. -syn sync clear -syn sync match ledgerSync grouphere ledgerTransaction "^[[:digit:]~=]" - -let b:current_syntax = "ledger" diff --git a/default.nix b/default.nix new file mode 100644 index 00000000..30da83ec --- /dev/null +++ b/default.nix @@ -0,0 +1,38 @@ +{ stdenv, fetchgit, cmake, boost, gmp, mpfr, libedit, python +, texinfo, gnused }: + +let + rev = "20141005"; +in + +stdenv.mkDerivation { + name = "ledger-3.1.0.${rev}"; + src = builtins.filterSource (path: type: type != "unknown") ./.; + + buildInputs = [ cmake boost gmp mpfr libedit python texinfo gnused ]; + + enableParallelBuilding = true; + + # Skip byte-compiling of emacs-lisp files because this is currently + # broken in ledger... + postInstall = '' + mkdir -p $out/share/emacs/site-lisp/ + cp -v "$src/lisp/"*.el $out/share/emacs/site-lisp/ + ''; + + meta = { + homepage = "http://ledger-cli.org/"; + description = "A double-entry accounting system with a command-line reporting interface"; + license = "BSD"; + + longDescription = '' + Ledger is a powerful, double-entry accounting system that is accessed + from the UNIX command-line. This may put off some users, as there is + no flashy UI, but for those who want unparalleled reporting access to + their data, there really is no alternative. + ''; + + platforms = stdenv.lib.platforms.all; + maintainers = with stdenv.lib.maintainers; [ simons the-kenny jwiegley ]; + }; +} diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 2777da68..46c3f73f 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -7,7 +7,7 @@ if (USE_DOXYGEN) find_package(Doxygen) - if(NOT DOXYGEN_FOUND) + if (NOT DOXYGEN_FOUND) message(FATAL_ERROR "Could not find doxygen. Reference documentation cannot be built.") endif() @@ -27,38 +27,55 @@ endif() ######################################################################## -if(NOT BUILD_DOCS) - add_custom_target(doc DEPENDS doc.doxygen) - return() +# BUILD_WEB_DOCS implies BUILD_DOCS +if (BUILD_WEB_DOCS) + set(BUILD_DOCS 1) endif() -set(info_files ledger3.texi ledger-mode.texi) +if (BUILD_DOCS) + find_program(MAKEINFO makeinfo) + find_program(TEXI2PDF texi2pdf) + find_program(TEX tex) + find_program(MAN2HTML man2html) + find_program(GROFF groff) + set(ledger_info_files ledger3.texi ledger-mode.texi) -find_program(MAKEINFO makeinfo) -find_program(TEXI2PDF texi2pdf) -find_program(MAN2HTML man2html) + if (NOT MAKEINFO) + message(WARNING "Could not find makeinfo. Info version of documentation cannot be built.") + endif() + + if (NOT TEXI2PDF OR NOT TEX) + message(WARNING "Could not find texi2pdf or tex. PDF version of documentation will not be built.") + endif() +endif() ######################################################################## -foreach(file ${info_files}) +foreach(file ${ledger_info_files}) get_filename_component(file_base ${file} NAME_WE) - if(BUILD_WEB_DOCS) - if(NOT MAKEINFO) - message(FATAL_ERROR "Could not find makeinfo. HTML version of documentation cannot be built.") - endif() + if (MAKEINFO) + 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 AND MAKEINFO) 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} VERBATIM) list(APPEND ledger_doc_files ${file_base}.html) - endif(BUILD_WEB_DOCS) + endif() - if(NOT TEXI2PDF) - message(WARNING "Could not find texi2pdf. PDF version of documentation will not be built.") - else() + if (TEXI2PDF AND TEX) + 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) @@ -67,20 +84,26 @@ endforeach() ######################################################################## -if(BUILD_WEB_DOCS) +if (BUILD_WEB_DOCS) include(FindUnixCommands) - if(NOT BASH) + 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) ######################################################################## @@ -91,16 +114,21 @@ add_custom_target(doc DEPENDS ${ledger_doc_files} doc.doxygen) include(GNUInstallDirs) -if(CMAKE_INSTALL_MANDIR) +if (CMAKE_INSTALL_MANDIR) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ledger.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc) endif(CMAKE_INSTALL_MANDIR) -foreach(file ${info_files}) - get_filename_component(file_base ${file} NAME_WE) +foreach(file ${ledger_doc_files}) + get_filename_component(file_ext ${file} EXT) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file} - DESTINATION ${CMAKE_INSTALL_INFODIR} COMPONENT doc) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file_base}.pdf - DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT doc OPTIONAL) + if(file_ext STREQUAL ".info") + if(CMAKE_INSTALL_INFODIR) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} + DESTINATION ${CMAKE_INSTALL_INFODIR} COMPONENT doc) + endif() + elseif(CMAKE_INSTALL_DOCDIR) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} + DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT doc) + endif() endforeach() diff --git a/doc/DEVELOP.md b/doc/DEVELOP.md new file mode 100644 index 00000000..ce897741 --- /dev/null +++ b/doc/DEVELOP.md @@ -0,0 +1,81 @@ +GLOSSARY +---- + +Developing the Ledger software uses a number different tools, not all of +which will be familiar to all developers. + +[**Boost**](http://www.boost.org): a standard set of C++ libraries. Most +Boost libraries consist of inline functions and templates in header files. + +[**Cheetah**](http://www.cheetahtemplate.org): a Python templating engine, +used by *./python/server.py*. + +[**CMake**](http://www.cmake.org): A cross platform system for building +from source code. It uses the *CMakeLists.txt* files. + +[**DOxygen**](http://doxygen.org): generates programming documentation from +source code files. Primarily used on C++ sources, but works on all. Uses +the *doc/Doxyfile.in* file. + +[**GCC**](http://gcc.gnu.org): Gnu Compiler Collection, which includes the +*gcc* compiler and *gcov* coverage/profiler tool. + +[**GMP**](https://gmplib.org): Gnu Multiple Precision Arithmetic Library +provides arbitrary precision math. + +[**Markdown**](https://daringfireball.net/projects/markdown/): A typesetter +format that produces *html* files from *.md* files. Note that GitHub +automatically renders *.md* files. + +[**sha1**](http://en.wikipedia.org/wiki/SHA-1): a marginally secure +cryptographic hash function, used only for signing the license file. + +[**Texinfo**](http://www.gnu.org/software/texinfo/): Gnu documentation +typesetter that produces *html* and *pdf* files from the *doc/\*.texi* +files. + +[**Travis CI**](https://travis-ci.org): a hosted continuous integration + service that builds and runs tests each commit posted to GitHub. Each + build creates a [log](https://travis-ci.org/ledger/ledger), updates a + [small graphic](https://travis-ci.org/ledger/ledger.png?branch=master) at + the top left of the main project's + [README.md](https://github.com/ledger/ledger/blob/master/README.md), and + emails the author of the commit if any tests fail. + +[**utfcpp**](http://utfcpp.sourceforge.net): a library for handling utf-8 +in a variety of C++ versions. + + +Orientation +--- + +The source tree can be confusing to a new developer. Here is a selective +orientation: + +**./acprep**: a custom thousand-line script to install dependencies, grab + updates, and build. It also creates *\*.cmake*, + *./CmakeFiles/* and other CMake temporary files. Use *./acprep --help* + for more information. + +**./README.md**: user readme file in markdown format, also used as the project + description on GitHub. + +**./contrib/**: contributed scripts of random quality and completion. They + usually require editing to run. + +**./doc/**: documentation, licenses, and + tools for generating documents such as the *pdf* manual. + +**./lib/**: a couple libraries used in development. + +**./lisp/**: the [Emacs](http://www.gnu.org/software/emacs/) + [ledger-mode](http://ledger-cli.org/3.0/doc/ledger-mode.html) lisp code, + under the [GPLv2](http://www.gnu.org/licenses/gpl-2.0.html) license. + +**./python/**: samples using the Python ledger module. + +**./src/**: the C++ header and source files in a flat directory. + +**./test/**: a testing harness with subdirectories full of tests + +**./tools/**: an accretion of tools, mostly small scripts, to aid development diff --git a/doc/DEVELOP.md.new b/doc/DEVELOP.md.new new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/doc/DEVELOP.md.new diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index e340d84a..95373660 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -938,7 +938,7 @@ HTML_STYLESHEET = # user-defined cascading style sheet that is included after the standard # style sheets created by doxygen. Using this option one can overrule # certain style aspects. This is preferred over using HTML_STYLESHEET -# since it does not replace the standard style sheet and is therefor more +# since it does not replace the standard style sheet and is therefore more # robust against future updates. Doxygen will copy the style sheet file to # the output directory. diff --git a/doc/GLOSSARY.md b/doc/GLOSSARY.md new file mode 100644 index 00000000..263a3cff --- /dev/null +++ b/doc/GLOSSARY.md @@ -0,0 +1,151 @@ +ACCOUNTING GLOSSARY +--- + + Accounting and bookkeeping represent an entire field of human effort and has + evolved its own specialized vocabulary. Accounting hopes to summarize and + add understanding to where the money is going. + +**Account**: A category for grouping together amounts from similar + transactions. Each account has a name, which is usually capitalized, and an + account type. Accounts are often organized into a hierarchy when it helps + understanding. For example, a coffee shop might have Coffee, Merchandise, + and Equipment as accounts but arranged under an Inventory account because + different decisions are made on the total inventory rather than just coffee. + A hierarchy can be part of the account name in Ledger, e.g., + "Assets:Inventory:Coffee". Note that the Ledger software usually creates + the list of accounts on the fly: accounts are created when transactions use + them. + +**Account Type**: Each account has a type of Asset, Liability, Equity, Income, + or Expense. Assets represent something owned, e.g., Cash or Inventory. + Liabilities represent sometime owed, e.g., a Loan or Mortgage. Equity, also + called capital, is everything owned minus everything owed (Assets - + Liabilities). It is the financial measure of how much you are ahead. + Income is money earned somewhere, which puts you more ahead. Expenses is + money spent somewhere, which puts you less ahead. The type of account + determines if a debit represents an increase or decrease in an account. For + example, Inventory is an asset so a transaction debiting Inventory would + increase its value. Assets and Expenses increase with debits and decrease + with credits; Liabilities, Equity, and Expenses increase with credits and + decrease with debits. + +**Journal**: A record of all the financial transactions of a person or firm. + This data of where money goes can be collated into reports. This used to be + done with a physical book, called a ledger, where each account was on one + page. Each debit or credit in the journal was transferred to the + appropriate account page and the pages were totaled to produce reports. + This process is now done with the Ledger software which creates reports from + the journal. A journal is sometimes called a register. + +**Posting**: A single debit or credit line of a transaction. A posting + comprises an account and the debit or credit amount. It also inherits the + shared description and date from the transaction. In the Ledger software, + a posting may also have metadata and an account state. + + +**Report**: A summary made from a journal of transactions. Each transaction + affects accounts and those effects are collated and totaled. The two most + common reports are the balance sheet, which shows what is owned and owed on + a specific date, and the cash flow statement, which shows how money was + earned and spent over a period. The cash flow statement is also called + a profit and loss statement or an income statement. + +**Transaction**: Our financial lives are recorded as a series of transactions. + Each transaction has a specific date, an equal total of debits and credits + affecting accounts, and some sort of description. For example, "On January + 1, pay $100 with check #243 from Checking to Utilities for my Verizon phone + bill" is a transaction. A credit of $100 decreases my Checking asset, while + a balancing debit of $100 increases my Utility expense. A transaction needs + at least two *postings*, meaning account debits or credits, but can be as + complicated as humans can make finances. + +LEDGER GLOSSARY +--- + +The Ledger software also has its own terms. + +**Automated Transaction**: a command directive that modifies subsequent + transactions that match an expression. An automated transaction can add + additional postings to a transaction, add metadata, or change transaction + amounts. Reports can be filter postings modified or generated by an + automated transaction. + [§ Automated Transactions](http://www.ledger-cli.org/3.0/doc/ledger3.html#Automated-Transactions); + [§ Concrete Example of Automated Transactions](http://www.ledger-cli.org/3.0/doc/ledger3.html#Concrete-Example-of-Automated-Transactions) + +**Command Directive**: a command in a journal file to change how subsequent + lines and transactions in a journal file are processed. Command directives + control processing, set default values for subsequent accounts and + transactions, or override parts of subsequent transactions. A directive + line begins with name of the directive and may have additional arguments or + additional indented lines. The single letters *AbCDhIiNOoY* are aliased to + other command directives, providing compatibility with the ancient past. + The characters **'='** and **'-'** are command directives for a automatic + transactions and periodic transactions, respectively. + [§ Command Directives](http://www.ledger-cli.org/3.0/doc/ledger3.html#Command-Directives) + +**Commodity**: any currency, stock, time or resource to be tracked + numerically. While many people only track money in Ledger, Ledger can track + different resources and manage rules to convert between them. The system is + flexible enough for the needs of very different users. Some track billable + time, converting minutes and hours into dollars. Others track multiple + currencies. Still others track the purchase and sale of stocks. Each + commodity is separate unless a conversion rule is given. + [§ Commodities and Currencies](http://www.ledger-cli.org/3.0/doc/ledger3.html#Commodities-and-Currencies); + [§ Currencies and Commodities](http://www.ledger-cli.org/3.0/doc/ledger3.html#Currency-and-Commodities); + [§ Accounts and Inventories](http://www.ledger-cli.org/3.0/doc/ledger3.html#Accounts-and-Inventories); + [§ Posting Cost](http://www.ledger-cli.org/3.0/doc/ledger3.html#Posting-cost) + *(and next ten sections)*; + [§ Commodity Reporting](http://www.ledger-cli.org/3.0/doc/ledger3.html#Commodity-Reporting) + +**Effective Date**: an optional, second date information item in for a posting + or transaction. Some use the effective date for when work is billed or when + a check has cleared. The `--effective-date` option causes the effective + date to override the transaction's initial date for that report. + [§ Effective Dates](http://www.ledger-cli.org/3.0/doc/ledger3.html#Effective-Dates); + +**Journal File**: the text input file for ledger, sometimes called a register + file. A journal file is a series of transactions, command directives, and + comments. Command directives start with the single word name of the + directive at the beginning of the line and include any following indented + lines. Transactions start with a date a the beginning of the line and + include any indented lines following. The journal file is expected to be + encoded as ASCII or UTF-8 text. + +**Periodic Transaction**: the estimate of a transaction that would occur + periodically, e.g., a monthly expense. These estimates are only used in + budgeting and forecasting reports using the `--budget`, `--forecast`, or + `--unbudgeted` options. + [§ Budgeting and Forecasting](http://www.ledger-cli.org/3.0/doc/ledger3.html#Budgeting-and-Forecasting) + +**Transaction Code**: an optional item in a transaction or posting often used + to record a check number or bank code. Certain custom reports can report + this code. + [§ Codes](http://www.ledger-cli.org/3.0/doc/ledger3.html#Codes); + [§ Format Expressions](http://www.ledger-cli.org/3.0/doc/ledger3.html#Format-Expressions) + +**Transaction Metadata**: a term for comments and tags annotating + a transaction. Comments indented with a transaction will be stored with + each posting of a transaction. Tags are words in comments followed by + colons. Tags can be used as filters in reports and certain tags, "Payee" or + "Value", may affect fields of the transaction. + [§ Metadata](http://www.ledger-cli.org/3.0/doc/ledger3.html#Metadata), + [§ Applying Metadata to every matched posting](http://www.ledger-cli.org/3.0/doc/ledger3.html#Applying-metadata-to-every-matched-posting), + [§ Applying Metadata to the generated posting](http://www.ledger-cli.org/3.0/doc/ledger3.html#Applying-metadata-to-the-generated-posting) + +**Transaction State**: a state of *cleared*, *pending*, or *uncleared* on each + posting. The state is usually set for an entire transaction at once with + a mark after the date. The marks are ***** (cleared), **!** (pending), + or no mark (uncleared). The interpretation of this state is up to the user, + but is typically used in bank reconciliations or differentiating time worked + versus billed. Ledger supports reports and filters based on state. + [§ Transaction State](http://www.ledger-cli.org/3.0/doc/ledger3.html#Transaction-state); + [§ Cleared Report]( http://www.ledger-cli.org/3.0/doc/ledger3.html#Cleared-Report) + +**Virtual Posting**: an annotation posting in a transaction, similar in form + as a regular posting but not required to balance debits and credits. It is + often used to support + [Fund Accounting](http://en.wikipedia.org/wiki/Fund_accounting) and various + reports will collate and summarize virtual postings. Virtual postings + should not be confused with virtual posting costs. + [§ Virtual Postings](http://www.ledger-cli.org/3.0/doc/ledger3.html#Virtual-postings) + [§ Working with Multiple Funds and Accounts](http://www.ledger-cli.org/3.0/doc/ledger3.html#Working-with-multiple-funds-and-accounts) diff --git a/doc/INSTALL b/doc/INSTALL deleted file mode 100644 index 5458714e..00000000 --- a/doc/INSTALL +++ /dev/null @@ -1,234 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006 Free Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - -Installation Names -================== - -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: - - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/doc/LICENSE b/doc/LICENSE index df1a0028..92be3a1d 100644 --- a/doc/LICENSE +++ b/doc/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2003-2009, John Wiegley. All rights reserved. +Copyright (c) 2003-2015, John Wiegley. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/doc/LICENSE-sha1 b/doc/LICENSE-sha1 deleted file mode 100644 index 8d886177..00000000 --- a/doc/LICENSE-sha1 +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (C) 1998
-Paul E. Jones <paulej@arid.us>
-All Rights Reserved.
-
-This software is licensed as "freeware." Permission to distribute
-this software in source and binary forms is hereby granted without
-a fee. THIS SOFTWARE IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESSED
-OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-THE AUTHOR SHALL NOT BE HELD LIABLE FOR ANY DAMAGES RESULTING
-FROM THE USE OF THIS SOFTWARE, EITHER DIRECTLY OR INDIRECTLY, INCLUDING,
-BUT NOT LIMITED TO, LOSS OF DATA OR DATA BEING RENDERED INACCURATE.
-
diff --git a/doc/LICENSE.rtf b/doc/LICENSE.rtf Binary files differindex 8da96b65..471065fe 100644 --- a/doc/LICENSE.rtf +++ b/doc/LICENSE.rtf @@ -1,5 +1,48 @@ Ledger NEWS +* 3.1 + +- Changed the definition of cost basis to preserve the original cost basis + when a gain or loss is made (if you bought 1 AAA for $10 and then sold + it for $12, ledger would previously take $12 as the cost; the original + cost of $10 is preserved as the cost basis now, which addresses strange + behavior with -B after a capital gain or loss is made). + +- Incorrect automatic Equity:Capital Gains and Equity:Capital Loss entries + are no longer generated when a commodity is sold for loss or profit. + +- Support for virtual posting costs. + +- The option --permissive now quiets balance assertions + +- Removed SHA1 files due to license issues and use boost instead. + +- Added option --no-pager to disable the pager. + +- Added option --no-aliases to completely disable alias expansion + +- Added option --recursive-aliases to expand aliases recursively + +- Support payee "uuid" directive. + +- Bug fix: when a status flag (! or *) is explicitly specified for an + individual posting, it always has a priority over entire transaction + status. + +- Bug fix: don't lose commodity when cost is not separated by whitespace + +- Improved backwards compatibility with ledger 2.x + +- Build fix for GCC 4.9 + +- Build fix for boost 1.56 + +- Many improvements to ledger-mode, including fontification + +- More test cases and unit tests + +- Contrib: Added script to generate commodities from ISO 4217 + * 3.0 Due to the magnitude of changes in 3.0, only changes that affect compatibility @@ -296,7 +339,7 @@ features, please see the manual. This flag limits computation to *only transactions whose amount is greater than 100 of a given commodity*. It means that if you scan your dining expenses, for example, only individual bills - greater than $100 would be caculated by the report. + greater than $100 would be calculated by the report. --only "a>100" @@ -538,7 +581,7 @@ features, please see the manual. * 2.4.1 -- Corrected an issue that had inadvertantly disabled Gnucash support. +- Corrected an issue that had inadvertently disabled Gnucash support. * 2.4 diff --git a/doc/README b/doc/README deleted file mode 100644 index 190436a2..00000000 --- a/doc/README +++ /dev/null @@ -1,64 +0,0 @@ - - Welcome to Ledger - - the command-line accounting program - -Introduction -============ - -Ledger is an accounting program which is invoked from the command-line using a -textual ledger file. To start using Ledger, you will need to create such a -file containing your financial postings. A sample has been provided in the -file "sample.dat". See the documentation (ledger.pdf, or ledger.info) for -full documentation on creating a ledger file and using Ledger to generate -reports. - -Once you have such a file -- you might call it "ledger.dat" -- you can start -looking at balances and account registers using commands like the following: - - ledger -f ledger.dat balance assets:checking - ledger -f ledger.dat register expenses:food - -This assumes, of course, that like the sample file you use account names such -as "Assets:Checking" and "Expenses:Food". If you use other account names, you -will need to vary the reporting commands you use accordingly. - - -Building -======== - -To build Ledger, you will need a fairly modern C++ compiler (gcc 2.95 will not -work), and at least these two libraries installed: - - gmp GNU multi-precision library - pcre Perl regular expression library - -(On some GNU/Linux systems, the packages you need to install are called -"gmp-dev" and "pcre-dev"). - -Once you have determined where the headers and libraries for the above -packages are installed, run the script "configure", passing those paths. If -you installed everything under /usr/local, you can probably just type -"./configure". Otherwise, do this: - - ./configure CPPFLAGS=-I<INCLUDE-PATH> LDFLAGS=-L<LIBRARY-PATH> - -If you need to specify multiple include or library paths, then do this: - - ./configure CPPFLAGS="-I<PATH1> -I<PATH2>" LDFLAGS="-L<PATH1> -L<PATH2>" - -Once configure is done running, just type: - - make install - - -Mailing List and IRC -==================== - -If you need help on how to use Ledger, or run into problems, you can join the -Ledger mailing list at the following Web address: - - http://groups.google.com/group/ledger-cli - -You can also find help at the #ledger channel on the IRC server -irc.freenode.net. diff --git a/doc/ledger-mode.texi b/doc/ledger-mode.texi index 8ab8e11d..b76cb309 100644 --- a/doc/ledger-mode.texi +++ b/doc/ledger-mode.texi @@ -89,6 +89,7 @@ reports and much more... * The Ledger Buffer:: * The Reconcile Buffer:: * The Report Buffer:: +* Scheduling Transactions:: * Customizing Ledger-mode:: * Generating Ledger Regression Tests:: * Embedding Example results in Ledger Documentation:: @@ -118,9 +119,9 @@ initialization file (@file{~/.emacs}, @file{~/.emacs.d/init.el}, or @file{~/.Aquamacs/Preferences.el}). @lisp +(autoload 'ledger-mode "ledger-mode" "A major mode for Ledger" t) (add-to-list 'load-path (expand-file-name "/path/to/ledger/source/lisp/")) -(load "ledger-mode") (add-to-list 'auto-mode-alist '("\\.ledger$" . ledger-mode)) @end lisp @@ -174,6 +175,13 @@ typing a close match to the payee. Ledger-mode will call @command{ledger xact} with the data you enter and place the transaction in the proper chronological place in the ledger. +If you need to add a lot of transactions that are not near your current +date you can set the current year and month so that using @samp{Add +Transaction} will prompt you with a more convenient month and year. To +set the month type @kbd{C-c RET} and enter the month you want. @kbd{C-c +C-y} will prompt you for the year. These settings only effect the +@samp{Add Transaction} command. + @node Reconciliation, Reports, Quick Add, Quick Demo @subsection Reconciliation @kindex C-c C-r @@ -217,10 +225,10 @@ Emacs will prompt for a report name. There are a few built-in reports, and you can add any report you need @xref{Adding and Editing Reports}. In the Minibuffer type @samp{account}. When prompted for an account -type @samp{checking}. In another buffer you will see a Ledger register -report. You can move around the buffer, with the point on a transaction, -type @kbd{C-c C-c}. Ledger-mode will take you directly to that -transaction in the @file{demo.ledger} buffer. +type @samp{checking}. In a buffer named @file{*Ledger Report*}, you +will see a Ledger register report. You can move around the buffer, with +the point on a transaction, type @kbd{RET}. Ledger-mode will take you +directly to that transaction in the @file{demo.ledger} buffer. Another built-in report is the balance report. In the @file{demo.ledger} buffer, type @kbd{C-c C-o C-r}. When prompted for @@ -230,13 +238,15 @@ will be shown. @node Narrowing, , Reports, Quick Demo @subsection Narrowing @kindex C-c C-f +@kindex C-c C-g A ledger file can get very large. It can be helpful to collapse the buffer to display only the transactions you are interested in. Ledger-mode copies the @command{occur} mode functionality. Typing @kbd{C-c C-f} and entering any regex in the Minibuffer will show only transactions that match the regex. The regex can be on any field, or -amount. +amount. Use @kbd{C-c C-g} after editing transactions to re-apply the +current regex. Cancel the narrowing by typing @kbd{C-c C-f} again. @node The Ledger Buffer, The Reconcile Buffer, Introduction to Ledger-mode, Top @chapter The Ledger Buffer @@ -246,17 +256,12 @@ amount. * Copying Transactions:: * Editing Amounts:: * Marking Transactions:: +* Formatting Transactions:: * Deleting Transactions:: * Sorting Transactions:: * Narrowing Transactions:: @end menu -@c TODO -@c Describe also: -@c - Align Region -@c - Set effective date C-c C-t -@c - Set Year C-c C-t -@c - Set Month C-c RET @node Adding Transactions, Copying Transactions, The Ledger Buffer, The Ledger Buffer @section Adding Transactions @@ -272,17 +277,35 @@ payees and accounts. Included files are not currently included in the completion scan. Repeatedly hitting @kbd{TAB} will cycle through the possible completions. -Ledger-mode can also help you keep your amounts in alignment. Setting +Ledger-mode can also help you keep your amounts aligned. Setting @option{ledger-post-auto-adjust-amounts} to true tells Ledger-mode to automatically place any amounts such that their last digit is aligned to the column specified by @option{ledger-post-amount-alignment-column}, which defaults to @samp{52}. @xref{Ledger Post Customization Group}. @menu +* Setting a Transactions Effective Date:: * Quick Balance Display:: @end menu -@node Quick Balance Display, , Adding Transactions, Adding Transactions +@node Setting a Transactions Effective Date, Quick Balance Display, Adding Transactions, Adding Transactions +@subsection Setting a Transactions Effective Date +@kindex C-c C-t +@cindex effective date + +Ledger provides for adding information to a transaction that add details +to the dates. For example, you can specify when the transaction was +entered, when the transaction was cleared, or when individual postings +were cleared. +Ledger-mode refers to these additional dates as @emph{effective} dates. +To set the effective date of a transaction, place the point in the first +line of a transaction and type @kbd{C-c C-t}. The effective date will +be added to the transaction. To set the effective date for an +individual posting, place point in the posting and type @kbd{C-c C-t} and +the effective date for that posting will be added at the end of the +posting. + +@node Quick Balance Display, , Setting a Transactions Effective Date, Adding Transactions @subsection Quick Balance Display @kindex C-c C-p @cindex balance @@ -326,7 +349,7 @@ but it cannot intercept the value being yanked form the @command{Calc} stack, so decimal-comma users will have to manually replace the period with a comma. -@node Marking Transactions, Deleting Transactions, Editing Amounts, The Ledger Buffer +@node Marking Transactions, Formatting Transactions, Editing Amounts, The Ledger Buffer @section Marking Transactions @cindex transaction, marking @cindex uncleared @@ -368,7 +391,20 @@ point in a transaction. This places an asterisk @samp{*} after the date. Clearing individual postings is done by typing @kbd{C-c C-c} while in a posting. This places an asterisk prior to the posting. -@node Deleting Transactions, Sorting Transactions, Marking Transactions, The Ledger Buffer +@node Formatting Transactions, Deleting Transactions, Marking Transactions, The Ledger Buffer +@section Formatting Transactions +@cindex transaction, formatting + +When editing a transaction, liberal use of the @kbd{TAB} key can keep +the transaction well formatted. If you want to have Ledger-mode cleanup +the formatting of a transaction you can use @samp{Align Transaction} or +@samp{Align Region} from the menu bar. + +The menu item @samp{Clean-up Buffer} sorts all transactions in the buffer +by date, removes extraneous empty lines and aligns every transaction. + + +@node Deleting Transactions, Sorting Transactions, Formatting Transactions, The Ledger Buffer @section Deleting Transactions @kindex C-c C-d @cindex transaction, deleting @@ -420,6 +456,7 @@ automatically delete old markers and put new new marker at point. @node Narrowing Transactions, , Sorting Transactions, The Ledger Buffer @section Narrowing Transactions @kindex C-c C-f +@kindex C-c C-g @cindex transaction, narrowing @cindex transaction, display filtering @@ -435,12 +472,11 @@ The regular expression can match on any part of the transaction. If you want to find all transactions whose amount ends in @samp{.37}, you can do that (I don't know why, but hey, whatever ever floats you aerostat). -Using @kbd{C-c C-f} or the @samp{Narrow to Regex} menu entry, enter -a regular expression in the Minibuffer. Ledger-mode will hide all other -transactions. For details of the regular expression syntax, see -@ref{(emacs)Regexps, Syntax of Regular Expressions} or -@ref{(elisp)Regular Expressions, Regular Expressions}. A few examples -using the @file{demo.ledger} are given here: +Using @kbd{C-c C-f} or the @samp{Narrow to Regex} menu entry, enter a +regular expression in the Minibuffer. Ledger-mode will hide all other +transactions. For details of the regular expression syntax, see your +Emacs documentation. A few examples using the @file{demo.ledger} are +given here: @table @samp @@ -466,6 +502,10 @@ Show only transactions with any line ending with @samp{harley}. To show back all transactions simply invoke @samp{Narrow to Regex} or @kbd{C-c C-f} again. +If you've edited some transactions after narrowing such that they would +no longer match the regular expression, you can refresh the narrowed +view using @kbd{C-c C-g}. + @node The Reconcile Buffer, The Report Buffer, The Ledger Buffer, Top @chapter The Reconcile Buffer @@ -592,7 +632,7 @@ the ledger buffer are left in that state when the account is switched. If for some reason during reconciliation your target amount changes, type @kbd{t} and enter the new target value. -@node The Report Buffer, Customizing Ledger-mode, The Reconcile Buffer, Top +@node The Report Buffer, Scheduling Transactions, The Reconcile Buffer, Top @chapter The Report Buffer @menu @@ -601,22 +641,18 @@ type @kbd{t} and enter the new target value. * Reversing Report Order:: @end menu -@c TODO Describe also: -@c - Goto Report C-c C-o C-g -@c - Re-run Report C-c C-o C-a -@c - Save Report C-c C-o C-s -@c - Kill Report C-c C-o C-k - @node Running Basic Reports, Adding and Editing Reports, The Report Buffer, The Report Buffer @section Running Reports @kindex C-c C-o C-r +@kindex C-c C-o C-g +@kindex C-c C-o C-a @cindex report, running The real power behind Ledger is in its amazing reporting capability. Ledger-mode provides easy facility to run reports directly from Emacs. It has four reports built-in and facilities for adding custom reports. -Typing @kbd{C-c C-o C-r} or using menu @samp{Ledger Run Report} prompt +Typing @kbd{C-c C-o C-r} or using menu @samp{Run Report} prompts for the name of a saved report. The built-in reports are: @table @var @@ -637,6 +673,18 @@ transactions involving that account. @end table +While viewing reports you can easily switch back and forth between the +ledger buffer and the @file{*Ledger Report*} buffer. In @file{*Ledger +Report*} buffer, typing @kbd{RET} will take you to that transaction in +the ledger buffer. While in the ledger buffer @kbd{C-c C-o C-g} returns +you to the @file{*Ledger Report*} buffer. + +By default Ledger-mode will refresh the report buffer when the ledger +buffer is saved. If you want to rerun the report at another time +@kbd{C-c C-o C-a}. This is useful if you have other programs altering +your ledger file outside of Emacs. + + @node Adding and Editing Reports, Reversing Report Order, Running Basic Reports, The Report Buffer @section Adding and Editing Reports @findex ledger-reports @@ -666,18 +714,21 @@ buffer you will have the option to give it a new name, or overwrite the old report. Deleting reports is accomplished by typing @kbd{C-c C-o C-e} or using -@samp{Edit Reports} menu in the ledger buffer, or typing @kbd{e} in the +@samp{Edit Report} menu in the ledger buffer, or typing @kbd{e} in the @file{*Ledger Report*} buffer. This takes you to the Emacs customization window for the Ledger Reports variables. Use the widgets to delete the report you want removed. +Typing @kbd{C-c C-o C-s} will prompt for a name and save the current +report. + @node Expansion Formats, Make Report Transactions Active, Adding and Editing Reports, Adding and Editing Reports @subsection Expansion Formats @cindex report, custom variable It is sometimes convenient to leave room to customize a report without saving the command line every time. For example running a register -report for a specific account, enter at runtime by the user. The +report for a specific account entered at runtime by the user. The built-in report @var{account} does exactly that, using a variable expansion to prompt the user for the account to use. There are four variables that can be expanded to run a report: @@ -693,9 +744,11 @@ Prompts for a payee. @item account Prompt for an account. -@c FIXME : is it 'value' or 'tag' for '@item value' just below? -@item value -Prompt for a tag value. +@item tagname +Prompt for a meta-data tag name. + +@item tagvalue +Prompt for a meta-data tag value. @end table @@ -738,7 +791,87 @@ recent transactions at the top, type @kbd{R} in the @file{*Ledger Report*} buffer and it will reverse the order of the transactions and maintain the proper mathematical sense. -@node Customizing Ledger-mode, Generating Ledger Regression Tests, The Report Buffer, Top +@node Scheduling Transactions, Customizing Ledger-mode, The Report Buffer, Top +@chapter Scheduling Transactions + +The Ledger program provides for automating transactions but these +transaction aren't ``real'', they only exist inside a ledger session and +are not reflected in the actual data file. Many transactions are very +repetitive, but may vary slightly in the date they occur on, or the +amount. Some transactions are weekly, monthly, quarterly or annually. +Ledger mode provides a way to schedule upcoming transaction with a +flexible scheduler that allows you to specify the transactions in a +separate ledger file and calculate the upcoming occurrences of those +transactions. You can then copy the transactions into your live data +file. + +@menu +* Specifying Upcoming Transactions:: +@end menu + +@node Specifying Upcoming Transactions, , Scheduling Transactions, Scheduling Transactions +@section Specifying Upcoming Transactions + +The format for specifying transactions is identical to Ledger's file +format with the exception of the date field. The data field is modified +by surrounding it with brackets and using wild cards and special +characters to specify when the transactions should appear. + +@menu +* Transactions that occur on specific dates:: +* Transactions that occur on specific days:: +@end menu + +@node Transactions that occur on specific dates, Transactions that occur on specific days, Specifying Upcoming Transactions, Specifying Upcoming Transactions +@subsection Transactions that occur on specific dates + +Many times you will enter repetitive transactions that occur on the same +day of the month each month. These can be specified using a wild card +in the year and month with a fixed date in the day. The following entry +specifies a transaction that occurs on the first and fifteenth of every +month in every year. +@example +[*/*/1,15] Paycheck + Income:Job $1000.00 + Assets:Checking +@end example + +Some transactions do not occur every month. Comma separated lists of +the months, or @samp{E} for even, or @samp{O} for odd number months can +also be specified. The following entry specifies a bi-monthly +exterminator bill that occurs in the even months: +@example +[*/E/01] Exterminator + Expenses:Home $100.00 + Assets:Checking +@end example + +@node Transactions that occur on specific days, , Transactions that occur on specific dates, Specifying Upcoming Transactions +@subsection Transactions that occur on specific days + +Some transactions occur every relative to the day of the week rather +than the date of the month. For example, many people are paid every two +weeks without regard to the day of the month. Other events may occur on +specific days regardless of the date. For example the following +transactions creates a transaction every other Thursday: + +@example +[2014/11/27+2Th] Paycheck + Income:Job $1000.00 + Assets:Checking +@end example + +It is necessary to specify a starting date in order for this type of +recurrence relation to be specified. The day names are two character +codes that default to Mo, Tu, We, Th, Fr, Sa, Su, for Monday, Tuesday, +Wednesday, Thursday, Friday, Saturday, Sunday respectively. You can +change the codes to something more convenient for your locale by +customizing the ledger @var{ledger-schedule-week-days}. They must be two +characters long. + + + +@node Customizing Ledger-mode, Generating Ledger Regression Tests, Scheduling Transactions, Top @chapter Customizing Ledger-mode @menu @@ -809,11 +942,11 @@ the reconcile regex. @item ledger-buffer-tracks-reconcile-buffer If non-nil, then when the cursor is moved to a new transaction in the -reconcile window. +@file{*Reconcile*} window. @item ledger-reconcile-force-window-bottom -If non-nil, make the reconcile window appear along the bottom of the -register window and resize. +If non-nil, make the @file{*Reconcile*} window appear along the bottom +of the register window and resize. @item ledger-reconcile-toggle-to-pending If non-nil, then toggle between uncleared and pending @samp{!}. If @@ -881,13 +1014,15 @@ Default face for Ledger occur mode shown transactions. Face for Ledger comments. @item ledger-font-reconciler-uncleared-face -Default face for uncleared transactions in the reconcile window. +Default face for uncleared transactions in the @file{*Reconcile*} buffer. @item ledger-font-reconciler-cleared-face -Default face for cleared @samp{*} transactions in the reconcile window. +Default face for cleared @samp{*} transactions in the @file{*Reconcile*} +buffer. @item ledger-font-reconciler-pending-face -Default face for pending @samp{!} transactions in the reconcile window. +Default face for pending @samp{!} transactions in the @file{*Reconcile*} +buffer. @item ledger-font-report-clickable-face FIXME @@ -996,3 +1131,8 @@ Work in Progress. @printindex ky @bye + +@c Local Variables: +@c mode: texinfo +@c TeX-master: t +@c End: diff --git a/doc/ledger.1 b/doc/ledger.1 index 659d3fbb..b4746eb9 100644 --- a/doc/ledger.1 +++ b/doc/ledger.1 @@ -182,7 +182,7 @@ Invert the value of amounts shown. .It Fl \-market Pq Fl V Show current market values for all amounts. This is determined in a somewhat magical fashion. It is probably more straightforward to use -.Fl \-exchange Pq Fl X . +.Fl \-exchange Ar commodity Pq Fl X . .It Fl \-period Ar time-period Pq Fl p Show postings only for the given .Ar time-period . @@ -281,193 +281,595 @@ transactions they are contained in. See the manual for more information. .Pp .Bl -tag -width -indent .It Fl \-abbrev-len Ar INT +Set the minimum length an account can be abbreviated to if it doesn't +fit inside the +.Nm account-width . +If +.Ar INT +is zero, then the +account name will be truncated on the right. If +.Ar INT +is greater +than +.Nm account-width +then the account will be truncated on the +left, with no shortening of the account names in order to fit into the +desired width. .It Fl \-account Ar STR +Prepend +.Ar STR +to all accounts reported. That is, the option +.Nm --account Personal +would tack +.Nm Personal: +to the beginning of every account reported in a balance report or register report. .It Fl \-account-width Ar INT +Set the width of the account column in the +.Nm register +report +to +.Ar INT +characters. .It Fl \-actual Pq Fl L +Report only real transactions, with no automated or virtual +transactions used. .It Fl \-add-budget +Show only un-budgeted postings. .It Fl \-amount Ar EXPR Pq Fl t +Apply the given value expression to the posting amount. Using +.Nm --amount Ar EXPR +you can apply an +arbitrary transformation to the postings. .It Fl \-amount-data Pq Fl j +On a register report print only the dates and amount of postings. +Useful for graphing and spreadsheet applications. .It Fl \-amount-width Ar INT +Set the width in characters of the amount column in the +.Nm register +report. .It Fl \-anon +Anonymize registry output, mostly for sending in bug reports. .It Fl \-args-only .It Fl \-auto-match .It Fl \-aux-date +Show auxiliary dates for all calculations. +Alias for +.Fl \-effective .It Fl \-average Pq Fl A +Print average values over the number of transactions instead of +running totals. .It Fl \-balance-format Ar FMT +Specify the format to use for the +.Nm balance +report. .It Fl \-base .It Fl \-basis Pq Fl B +Report the cost basis on all posting. +Alias for +.Fl \-cost .It Fl \-begin Ar DATE Pq Fl b +Specify the start +.Ar DATE +of all calculations. Transactions before +that date will be ignored. .It Fl \-bold-if Ar EXPR +Print the entire line in bold if the given value expression is true. .It Fl \-budget +Only display budgeted items. In a register report this +displays transaction in the budget, in a balance report this displays +accounts in the budget. .It Fl \-budget-format Ar FMT +Specify the format to use for the +.Nm budget +report. .It Fl \-by-payee Pq Fl P +Group postings in the register report by common payee names. .It Fl \-cache Ar FILE .It Fl \-check-payees +Enable strict and pedantic checking for payees as well as accounts, +commodities and tags. .It Fl \-cleared Pq Fl C +Display only cleared postings. .It Fl \-cleared-format Ar FMT +Specify the format to use for the +.Nm cleared +report .It Fl \-collapse Pq Fl n +By default ledger prints all accounts in an account tree. With +.Fl \-collapse +it prints only the top level account specified. .It Fl \-collapse-if-zero +Collapse the account display only if it has a zero balance. .It Fl \-color +Use color if the terminal supports it. +Alias for +.Fl \-ansi .It Fl \-columns Ar INT +Specify the width of the +.Nm register +report in characters. .It Fl \-cost -See +Report the cost basis on all posting. +Alias for .Fl \-basis . .It Fl \-count +Direct ledger to report the number of items when appended to the +.Nm commodities , +.Nm accounts +or +.Nm payees +commands. .It Fl \-csv-format Ar FMT +Specify the format to use for the +.Nm csv +report .It Fl \-current Pq Fl c -.It Fl \-daily +Shorthand for +.Nm --limit 'date <= today' . +.It Fl \-daily Pq Fl D +Shorthand for +.Nm --period 'daily' . .It Fl \-date Ar EXPR +Transform the date of the transaction using +.Ar EXPR . .It Fl \-date-format Ar DATEFMT Pq Fl y +Specify the format ledger should use to print dates. .It Fl \-datetime-format Ar FMT .It Fl \-date-width Ar INT +Specify the width, in characters, of the date column in the +.Nm register +report. .It Fl \-day-break .It Fl \-dc +Display register or balance in debit/credit format If you use +.Fl \-dc +with either the register (reg) or balance (bal) commands, +you will now get separate columns for debits and credits. .It Fl \-debug Ar STR +If Ledger has been built with debug options this will provide extra +data during the run. .It Fl \-decimal-comma +Direct Ledger to parse journals using the European standard comma as +decimal separator, vice a period. .It Fl \-depth Ar INT +Limit the depth of the account tree. In a balance report, for example, +a +.Fl \-depth 2 +statement will print balances only for account with +two levels, i.e. +.Nm Expenses:Entertainment +but not +.Nm Expenses:entertainment:Dining . +This is a display predicate, which +means it only affects display, not the total calculations. .It Fl \-deviation Pq Fl D +Report each posting’s deviation from the average. It is only meaningful +in the register and prices reports. .It Fl \-display Ar EXPR Pq Fl d +Display lines that satisfy the expression +.Ar EXPR . .It Fl \-display-amount Ar EXPR +Apply a transformation to the +.Nm displayed +amount. This occurs after +calculations occur. .It Fl \-display-total Ar EXPR +Apply a transformation to the +.Nm displayed +total. This occurs after +calculations occur. .It Fl \-dow +Group transactions by the days of the week. +Alias for +.Fl \-days-of-week .It Fl \-download +Cause quotes to be automagically downloaded, as needed, by running +a script named +.Nm getquote +and expecting that script to return +a value understood by ledger. A sample implementation of +a +.Nm getquote +script, implemented in Perl, is provided in the +distribution. Downloaded quote price are then appended to the price +database, usually specified using the environment variable +.Nm LEDGER_PRICE_DB . .It Fl \-empty Pq Fl E -.It Fl \-end Pq Fl e +Include empty accounts in report. +.It Fl \-end Ar DATE Pq Fl e +Specify the end +.Ar DATE +for a transaction to be considered in the +report. .It Fl \-equity +Related to the +.Nm equity +command. Gives current account balances in the form of a register +report. .It Fl \-exact -.It Fl \-exchange Ar COMM Oo , COMM, ... Oc Pq Fl X +.It Fl \-exchange Ar COMMODITY Oo , COMM, ... Oc Pq Fl X +Display values in terms of the given +.Ar COMMODITY . +The latest available price is used. .It Fl \-explicit .It Fl \-file Ar FILE +Read +.Ar FILE +as a ledger file. .It Fl \-first Ar INT -See +Print the first +.Ar INT +entries. Opposite of +.Fl \-tail Ar INT . +Alias for .Fl \-head . .It Fl \-flat +Force the full names of accounts to be used in the balance report. The +balance report will not use an indented tree. .It Fl \-force-color +Output TTY color codes even if the TTY doesn't support them. Useful +for TTYs that don't advertise their capabilities correctly. .It Fl \-force-pager +Force Ledger to paginate its output. .It Fl \-forecast-while Ar EXPR -(Also -.Fl \-forecast -). +Continue forecasting while +.Ar VEXPR +is true. +Alias for +.Fl \-forecast . .It Fl \-forecast-years Ar INT +Forecast at most +.Ar INT +years into the future. .It Fl \-format Ar FMT Pq Fl F -.It Fl \-full-help +Use the given format string +.Ar FMT +to print output. .It Fl \-gain Pq Fl G +Report net gain or loss for commodities that have a price history. .It Fl \-generated +Include auto-generated postings (such as those from automated +transactions) in the report, in cases where you normally wouldn't want +them. .It Fl \-group-by Ar EXPR +Group transaction together in the +.Nm register +report. +.Ar EXPR +can be anything, although most common would be +.Nm payee +or +.Nm commodity . +The +.Nm tags() +function is also useful here. .It Fl \-group-title-format Ar FMT +Set the format for the headers that separate reports section of +a grouped report. Only has effect with a +.Fl \-group-by Ar EXPR +register report. .It Fl \-head Ar INT +Print the first +.Ar INT +entries. Opposite of +.Fl \-tail Ar INT . +Alias for +.Fl \-first .It Fl \-help -.It Fl \-help-calc -.It Fl \-help-comm -.It Fl \-help-disp +Print a summary of all the options, and what they are used for. This +can be a handy way to remember which options do what. This help screen +is also printed if ledger is run without a command. .It Fl \-immediate -.It Fl \-import Ar STR +Instruct ledger to evaluate calculations immediately rather than lazily. .It Fl \-init-file Ar FILE +Causes +.Nm FILE +to be read by ledger before any other ledger file. +This file may not contain any postings, but it may contain option +settings. To specify options in the init file, use the same syntax as +the command-line, but put each option on its own line. .It Fl \-inject Ar STR +TODO .It Fl \-input-date-format Ar DATEFMT +Specify the input date format for journal entries. .It Fl \-invert +Change the sign of all reported values. .It Fl \-last Ar INT -See +Report only the last +.Ar INT +entries. Only useful on a register +report. +Alias for .Fl \-tail . .It Fl \-leeway Ar INT Pq Fl Z +Alias for +.Fl \-price-expr . .It Fl \-limit Ar EXPR Pq Fl l +Limit postings in calculations. .It Fl \-lot-dates +Report the date on which each commodity in a balance report was +purchased. .It Fl \-lot-notes +Report the tag attached to each commodity in a balance report. .It Fl \-lot-prices +Report the price at which each commodity in a balance report was +purchased. .It Fl \-lots +Report the date and price at which each commodity was purchased in +a balance report. .It Fl \-lots-actual .It Fl \-market Pq Fl V +Use the latest market value for all commodities. .It Fl \-master-account Ar STR +Prepend all account names with +.Ar STR .It Fl \-meta Ar EXPR +In the register report, prepend the transaction with the value of the given +.Ar TAG . .It Fl \-meta-width Ar INT +Specify the width of the Meta column used for the +.Fl \-meta Ar TAG +options. .It Fl \-monthly Pq Fl M +Shorthand for +.Fl \-period 'monthly' . +.It Fl \-no-aliases +Aliases are completely ignored. .It Fl \-no-color -.It Fl \-no-pager +Suppress any color TTY output. .It Fl \-no-rounding +Don't output +.Nm <Rounding> +postings. Note that this will cause the +running total to often not add up! It's main use is for +.Fl \-amount-data Pq Fl j +and +.Fl \-total-data Pq Fl J +reports. .It Fl \-no-titles +Suppress the output of group titles. .It Fl \-no-total +Suppress printing the final total line in a balance report. .It Fl \-now Ar DATE +Define the current date in case to you to do calculate in the past or +future using +.Fl \-current . .It Fl \-only Ar EXPR +This is a postings predicate that applies after certain transforms have +been executed, such as periodic gathering. .It Fl \-options +Display the options in effect for this Ledger invocation, along with +their values and the source of those values. .It Fl \-output Ar FILE Pq Fl o +Redirect the output of ledger to the file defined in +.Ar FILE . .It Fl \-pager Ar STR +Specify the pager program to use as +.Ar STR . .It Fl \-payee +Sets a value expression for formatting the payee. In the +.Nm register +report this prevents the second entry from having +a date and payee for each transaction. .It Fl \-payee-width Ar INT +Set the number of columns dedicated to the payee in the register +report to +.Ar INT . .It Fl \-pedantic +Accounts, tags or commodities not previously declared will cause errors. .It Fl \-pending -.It Fl \-percent Pq Fl \% +Use only postings that are marked pending. +.It Fl \-percent Pq Fl \b'%' +Calculate the percentage value of each account in a balance reports. +Only works for account that have a single commodity. .It Fl \-period Ar PERIOD Pq Fl p +Define a period expression that sets the time period during which +transactions are to be accounted. For a +.Nm register +report only +the transactions that satisfy the period expression with be displayed. +For a balance report only those transactions will be accounted in the +final balances. .It Fl \-period-sort +Sort the posting within transactions using the given value expression. .It Fl \-permissive .It Fl \-pivot Ar STR +Produce a balance pivot report +.Nm around +the given +.Ar TAG . .It Fl \-plot-amount-format Ar FMT +Define the output format for an amount data plot. .It Fl \-plot-total-format Ar FMT +Define the output format for a total data plot. .It Fl \-prepend-format Ar FMT +Prepend +.Ar STR +to every line of the output. .It Fl \-prepend-width Ar INT +Reserve +.Ar INT +spaces at the beginning of each line of the output. .It Fl \-price Pq Fl I +Use the price of the commodity purchase for performing calculations. .It Fl \-price-db Ar FILE -.It Fl \-price-exp Ar STR -See -.Fl \-leeway . +.It Fl \-price-exp Ar STR Pq Fl Z +Set the expected freshness of price quotes, in +.Ar INT +minutes. That +is, if the last known quote for any commodity is older than this value, +and if +.Fl \-download +is being used, then the Internet will be +consulted again for a newer price. Otherwise, the old price is still +considered to be fresh enough. +Alias for +.Fl \-leeway Ar INT Pq Fl Z .It Fl \-prices-format Ar FMT .It Fl \-pricedb-format Ar FMT .It Fl \-primary-date +Show primary dates for all calculations. Alias for +.Fl \-actual-dates .It Fl \-quantity Pq Fl O +Report commodity totals (this is the default). .It Fl \-quarterly +Synonym for +\Fl \-period 'quarterly' . .It Fl \-raw -For use only with the +In the .Nm print -command, it causes Ledger to print out matching entries exactly as they -appeared in the original journal file. +report, show transactions using the exact same syntax as +specified by the user in their data file. Don't do any massaging or +interpreting. Can be useful for minor cleanups, like just aligning +amounts. .It Fl \-real Pq Fl R +Account using only real transactions ignoring virtual and automatic +transactions. +.It Fl \-recursive-aliases +Causes ledger to try to expand aliases recursively, i.e. try to expand +the result of an earlier expansion again, until no more expansions apply. .It Fl \-register-format Ar FMT +Define the output format for the +.Nm register +report. .It Fl \-related Pq Fl r +In a register report show the related account. This is the other +.Nm side +of the transaction. .It Fl \-related-all +Show all postings in a transaction, similar to +.Fl \-related +but show +.Nm both sides +of each transaction. .It Fl \-revalued .It Fl \-revalued-only .It Fl \-revalued-total Ar EXPR .It Fl \-rich-data .It Fl \-seed Ar INT -.It Fl \-script +Set the random seed to +.Ar INT +for the +.Nm generate +command. Used as part of development testing. +.It Fl \-script Ar FILE +Execute a ledger script. .It Fl \-sort Ar EXPR Pq Fl S +Sort the register report based on the value expression given to sort. .It Fl \-sort-all .It Fl \-sort-xacts +Sort the posting within transactions using the given value expression. .It Fl \-start-of-week Ar STR +Tell ledger to use a particular day of the week to start its "weekly" +summary. +.Fl \-start-of-week=1 +specifies Monday as the start of the week. .It Fl \-strict +Accounts, tags or commodities not previously declared will cause warnings. .It Fl \-subtotal Pq Fl s +Report register as a single subtotal. .It Fl \-tail Ar INT +Report only the last +.Ar INT +entries. Only useful on a register report. Alias for +.Fl \-last Ar INT .It Fl \-time-report -.It Fl \-total Ar EXPR +.It Fl \-total Ar EXPR Pq Fl T +Define a value expression used to calculate the total in reports. .It Fl \-total-data Pq Fl J +Show only dates and totals to format the output for plots. .It Fl \-total-width Ar INT +Set the width of the total field in the register report. .It Fl \-trace Ar INT -.It Fl \-truncate +Enable tracing. The +.Ar INT +specifies the level of trace desired. +.It Fl \-truncate Ar CODE +Indicates how truncation should happen when the contents of columns +exceed their width. Valid arguments are +.Nm leading , Nm middle , +and +.Nm trailing . +The default is smarter than any of these three, +as it considers sub-names within the account name (that style is +called "abbreviate"). .It Fl \-unbudgeted +Show only un-budgeted postings. .It Fl \-uncleared Pq Fl U +Use only uncleared transactions in calculations and reports. .It Fl \-unrealized +Show generated unrealized gain and loss accounts in the balance +report. .It Fl \-unrealized-gains +Allow the user to specify what account name should be used for +unrealized gains. Defaults to +.Nm "Equity:Unrealized Gains" . +Often set in one's +.Nm ~/.ledgerrc +file to change the default. .It Fl \-unrealized-losses +Allow the user to specify what account name should be used for +unrealized gains. Defaults to +.Nm "Equity:Unrealized Losses" . +Often set in one's +.Nm ~/.ledgerrc +file to change the default. .It Fl \-unround +Perform all calculations without rounding and display results to full +precision. +.It Fl \-values +Shows the values used by each tag when used in combination with the +.Nm tags +command. .It Fl \-value-expr Ar EXPR .It Fl \-verbose +Print detailed information on the execution of Ledger. .It Fl \-verify +Enable additional assertions during run-time. This causes a significant +slowdown. When combined with +.Fl \-debug Ar CODE +ledger will produce memory trace information. .It Fl \-verify-memory .It Fl \-version +Print version information and exit. .It Fl \-weekly Pq Fl W +Synonym for +.Fl \-period 'weekly' . .It Fl \-wide Pq Fl w +Assume 132 columns instead of 80. .It Fl \-yearly Pq Fl Y +Synonym for +.Fl \-period 'yearly' . .El .Pp -.Sh PRECOMMANDS +.Sh PRE-COMMANDS +Pre-commands are useful when you aren't sure how a command or option +will work. The difference between a pre-command and a regular command +is that pre-commands ignore the journal data file completely, nor is +the user's init file read. .Pp .Bl -tag -width -indent -.It Nm args +.It Nm args / query +Evaluate the given arguments and report how Ledger interprets it against +the following model transaction. .It Nm eval +Evaluate the given value expression against the model transaction. .It Nm format -.It Nm parse +Print details of how ledger uses the given formatting description and +apply it against a model transaction. +.It Nm parse / expr +Print details of how ledger uses the given value expression description +and apply it against a model transaction. +.It Nm generate +Randomly generates syntactically valid Ledger data from a seed. Used +by the GenerateTests harness for development testing. .It Nm period -.It Nm python +Evaluate the given period and report how Ledger interprets it. +.It Nm script .It Nm template +Shows the insertion template that the +.Nm xact sub-command generates. +This is a debugging command. .El .Pp .Sh QUERIES diff --git a/doc/ledger3.texi b/doc/ledger3.texi index e95640e8..4dc3f48f 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -14,15 +14,88 @@ @c | @var | | Ledger CLI option Variable (like -f FILE) | @c | | | Ledger file Syntax | @c | @samp | | Valued example or single char | -@c | @file | | File | +@c | @file | | File, Buffer | @c | @file | | Program (like ledger, report, acprep) | @c Restructuring manual ideas @c http://beyondgrep.com/documentation/ack-2.04-man.html +@c How to make documented ledger examples validate automatically. +@c +@c The test/DocTests.py script will be run along with the other tests +@c when using ctest or acprep check. +@c The script parses the texinfo file and looks for three kinds of +@c specially marked @smallexamples, then it will run the ledger +@c command from the example, and compare the results with the output +@c from the documentation. +@c +@c To specially mark a @smallexample append @c command:UUID, where +@c UUID is the first 7 digits from the commands sha1sum, e.g.: +@c +@c @smallexample @c command:CDE330A +@c $ ledger -f sample.dat reg expenses +@c @end smallexample +@c +@c Then DocTests.py will look for corresponding documented output, +@c which may appear anywhere in the file, and is marked with +@c @smallexample @c output:UUID where UUID is the UUID from the +@c corresponding ledger command example, e.g.: +@c +@c @smallexample @c output:CDE330A +@c 04-May-27 Book Store Expenses:Books $20.00 $20.00 +@c Expenses:Cards $40.00 $60.00 +@c Expenses:Docs $30.00 $90.0 +@c @end smallexample +@c +@c Now where does this data in sample.dat come from? +@c DocTests.py is a bit smart about ledger's file argument, since +@c it will check if the given filename exists in the test/input/ +@c directory. +@c +@c Sometimes the journal data for an example is specified within +@c the documentation itself, in that case the journal example data +@c needs to be specially marked as well using @smallexample @c input:UUID, +@c again with the UUID being the UUID of the corresponding ledger example +@c command. If multiple inputs with the same UUID are found they will be +@c concatenated together and given as one set of data to the example command. +@c +@c @smallexample @c input:35CB2A3 +@c 2014/02/09 The Italian Place +@c Expenses:Food:Dining $ 36.84 +@c Assets:Cash +@c @end smallexample +@c +@c @smallexample @c command:35CB2A3 +@c $ ledger -f inline.dat accounts +@c @end smallexample +@c +@c @smallexample @c output:35CB2A3 +@c Assets:Cash +@c Expenses:Food:Dining +@c @end smallexample +@c +@c To use different example commands with the same input from the documentation +@c add with_input:UUID to the example command, where UUID is the UUID of the input, +@c e.g.: +@c +@c @smallexample @c command:94FD2B6,with_input:35CB2A3 +@c $ ledger -f inline.dat bal expenses +@c @end smallexample +@c +@c @smallexample @c output:94FD2B6 +@c $ 36.84 Expenses:Food:Dining +@c @end smallexample +@c +@c Additionally DocTests.py will pass --args-only and --columns 80 to ledger +@c to ignore any default arguments from the environment or .ledgerrc. +@c +@c To manually run the tests in this file run: +@c $ ./test/DocTests.py -vv --ledger ./ledger --file ./doc/ledger3.texi + + @copying -Copyright @copyright{} 2003–2013, John Wiegley. All rights reserved. +Copyright @copyright{} 2003–2015, John Wiegley. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -73,7 +146,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @titlepage @title Ledger: Command-Line Accounting -@subtitle For Version 3.0 of Ledger +@subtitle For Version 3.1 of Ledger @author John Wiegley @page @vskip 0pt plus 1filll @@ -166,9 +239,9 @@ accounting tools. The next step up from a checkbook journal, is a journal that keeps track of all your accounts, not just checking. In such a journal, you record not only who gets paid---in the case of a debit---but where the -money came from. In a checkbook journal, its assumed that all the +money came from. In a checkbook journal, it's assumed that all the money comes from your checking account. But in a general journal, you -write posting two-lines: the source account and target account. +write postings in two lines: the source account and target account. @emph{There must always be a debit from at least one account for every credit made to another account}. This is what is meant by ``double-entry'' accounting: the journal must always balance to zero, @@ -214,10 +287,10 @@ Most private people consider an account to be something that holds money at an institution for them. Ledger uses a more general definition of the word. An account is anywhere money can go. Other finance programs use ``categories'', Ledger uses accounts. So, for -example, if you buy some groceries at Trader Joe's then more groceries -at Whole Foods Markets you might assign the transactions like this +example, if you buy some groceries at Trader Joe's, then more groceries +at Whole Food Market, you might assign the transactions like this -@smallexample +@smallexample @c input:validate 2011/03/15 Trader Joe's Expenses:Groceries $100.00 Assets:Checking @@ -245,7 +318,7 @@ And just for the sake of example---as a starting point for those who want to dive in head-first---here are the journal transactions from above, formatted as the Ledger program wishes to see them: -@smallexample +@smallexample @c input:48DDF26 2004/09/29 Pacific Bell Expenses:Pacific Bell $23.00 Assets:Checking @@ -254,12 +327,37 @@ above, formatted as the Ledger program wishes to see them: The account balances and registers in this file, if saved as @file{ledger.dat}, could be reported using: -@smallexample +@smallexample @c command:48DDF26 $ ledger -f ledger.dat balance +@end smallexample + +@smallexample @c output:48DDF26 + $-23.00 Assets:Checking + $23.00 Expenses:Pacific Bell +-------------------- + 0 +@end smallexample + +Or + +@smallexample @c command:8C7295F,with_input:48DDF26 $ ledger -f ledger.dat register checking +@end smallexample + +@smallexample @c output:8C7295F +04-Sep-29 Pacific Bell Assets:Checking $-23.00 $-23.00 +@end smallexample + +And even: + +@smallexample @c command:BB32EF2,with_input:48DDF26 $ ledger -f ledger.dat register Bell @end smallexample +@smallexample @c output:BB32EF2 +04-Sep-29 Pacific Bell Expenses:Pacific Bell $23.00 $23.00 +@end smallexample + An important difference between Ledger and other finance packages is that Ledger will never alter your input file. You can create and edit that file in any way you prefer, but Ledger is only for analyzing the @@ -286,14 +384,14 @@ $ ./configure && make install Ledger has a complete online help system based on GNU Info. This manual can be searched directly from the command line using the -following options: @code{ledger --help} bring up this entire manual in -your tty. +following options: @code{ledger --help} brings up this entire manual in +your TTY. If you need help on how to use Ledger, or run into problems, you can join the Ledger mailing list at @url{http://groups.google.com/group/ledger-cli}. -You can also find help at the @code{#ledger} channel on the IRC server +You can also find help in the @code{#ledger} channel on the IRC server @code{irc.freenode.net}. @node Ledger Tutorial, Principles of Accounting with Ledger, Introduction to Ledger, Top @@ -331,11 +429,11 @@ If you would rather start with your own journal right away please Please note that as a command line program, Ledger is controlled from your shell. There are several different command shells that all behave slightly differently with respect to some special characters. -In particular, the BASH shell will interpret @samp{$} signs +In particular, the ``bash'' shell will interpret @samp{$} signs differently than ledger and they must be escaped to reach the actual -program. Another example is zsh, which will interpret @samp{^} +program. Another example is ``zsh'', which will interpret @samp{^} differently than ledger expects. In all cases that follow you should -take that into account when entering the command line arguments given. +take that into account when entering the command line arguments as given. There are too many variations between shells to give concrete examples for each. @@ -346,13 +444,13 @@ for each. To find the balances of all of your accounts, run this command: -@smallexample +@smallexample @c command:1071890 $ ledger -f drewr3.dat balance @end smallexample Ledger will generate: -@smallexample +@smallexample @c output:1071890 $ -3,804.00 Assets $ 1,396.00 Checking $ 30.00 Business @@ -381,8 +479,11 @@ pare this down to show only the accounts you want. A more useful report is to show only your Assets and Liabilities: -@smallexample +@smallexample @c command:5BF4D8E $ ledger -f drewr3.dat balance Assets Liabilities +@end smallexample + +@smallexample @c output:5BF4D8E $ -3,804.00 Assets $ 1,396.00 Checking $ 30.00 Business @@ -402,16 +503,16 @@ $ ledger -f drewr3.dat balance Assets Liabilities To show all transactions and a running total: -@smallexample +@smallexample @c command:66E3A2C $ ledger -f drewr3.dat register @end smallexample @noindent Ledger will generate: -@smallexample +@smallexample @c output:66E3A2C 10-Dec-01 Checking balance Assets:Checking $ 1,000.00 $ 1,000.00 - Equity:Opening Balances $ -1,000.00 0 + Equit:Opening Balances $ -1,000.00 0 10-Dec-20 Organic Co-op Expense:Food:Groceries $ 37.50 $ 37.50 Expense:Food:Groceries $ 37.50 $ 75.00 Expense:Food:Groceries $ 37.50 $ 112.50 @@ -450,8 +551,11 @@ interested in seeing transactions for: @cindex accounts, limiting by @cindex limiting by accounts -@smallexample +@smallexample @c command:96B0EB3 $ ledger -f drewr3.dat register Groceries +@end smallexample + +@smallexample @c output:96B0EB3 10-Dec-20 Organic Co-op Expense:Food:Groceries $ 37.50 $ 37.50 Expense:Food:Groceries $ 37.50 $ 75.00 Expense:Food:Groceries $ 37.50 $ 112.50 @@ -465,8 +569,11 @@ $ ledger -f drewr3.dat register Groceries @noindent Which matches the balance reported for the @samp{Groceries} account: -@smallexample +@smallexample @c command:AECD64E $ ledger -f drewr3.dat balance Groceries +@end smallexample + +@smallexample @c output:AECD64E $ 334.00 Expenses:Food:Groceries @end smallexample @@ -474,8 +581,11 @@ $ ledger -f drewr3.dat balance Groceries If you would like to find transaction to only a certain payee use @samp{payee} or @samp{@@}: -@smallexample +@smallexample @c command:C6BC57E $ ledger -f drewr3.dat register payee "Organic" +@end smallexample + +@smallexample @c output:C6BC57E 10-Dec-20 Organic Co-op Expense:Food:Groceries $ 37.50 $ 37.50 Expense:Food:Groceries $ 37.50 $ 75.00 Expense:Food:Groceries $ 37.50 $ 112.50 @@ -497,8 +607,11 @@ a check to clear, but you should treat it as money spent. The @command{cleared} report will not format correctly for accounts that contain multiple commodities): -@smallexample +@smallexample @c command:B86F6A6 $ ledger -f drewr3.dat cleared +@end smallexample + +@smallexample @c output:B86F6A6 $ -3,804.00 $ 775.00 Assets $ 1,396.00 $ 775.00 10-Dec-20 Checking $ 30.00 0 Business @@ -517,8 +630,8 @@ $ ledger -f drewr3.dat cleared $ -20.00 0 MasterCard $ 200.00 0 Mortgage:Principal $ -243.60 0 Tithe ----------------- ---------------- --------- - $ -243.60 0 +---------------- ---------------- --------- + $ -243.60 0 @end smallexample @noindent @@ -531,7 +644,7 @@ shows the ``cleared'' balance. @cindex currency symbol display on windows Using ledger under the windows command shell has one significant -limitation. CMD.exe is limited to standard ASCII characters and as +limitation. CMD.EXE is limited to standard ASCII characters and as such cannot display any currency symbols other than dollar signs @samp{$}. @@ -555,9 +668,9 @@ such cannot display any currency symbols other than dollar signs Accounting is simply tracking your money. It can range from nothing, and just waiting for automatic overdraft protection to kick in, or -not, to a full blown double entry accounting system. Ledger +not, to a full-blown double-entry accounting system. Ledger accomplishes the latter. With ledger you can handle your personal -finances or your businesses. Double-entry accounting scales. +finances or your business's. Double-entry accounting scales. @node Stating where money goes, Assets and Liabilities, Accounting with Ledger, Principles of Accounting with Ledger @section Stating where money goes @@ -578,7 +691,7 @@ where the money comes from and where it goes to. For example, when you are paid a salary, you must add money to your bank account and also subtract it from an income account: -@smallexample +@smallexample @c input:validate 9/29 My Employer Assets:Checking $500.00 Income:Salary $-500.00 @@ -624,7 +737,7 @@ owe. ``Liabilities'' is just a more inclusive name for Debts. An Asset is typically increased by transferring money from an Income account, such as when you get paid. Here is a typical transaction: -@smallexample +@smallexample @c input:6B43DD4 2004/09/29 My Employer Assets:Checking $500.00 Income:Salary @@ -639,7 +752,7 @@ borrow money to buy something, or if you owe someone money. Here is an example of increasing a MasterCard liability by spending money with it: -@smallexample +@smallexample @c input:6B43DD4 2004/09/30 Restaurant Expenses:Dining $25.00 Liabilities:MasterCard @@ -653,10 +766,17 @@ offsets the value of your assets. The combined total of your Assets and Liabilities is your net worth. So to see your current net worth, use this command: -@smallexample +@smallexample @c command:6B43DD4 $ ledger balance ^assets ^liabilities @end smallexample +@smallexample @c output:6B43DD4 + $500.00 Assets:Checking + $-25.00 Liabilities:MasterCard +-------------------- + $475.00 +@end smallexample + In a similar vein, your Income accounts show up negative, because they transfer money @emph{from} an account in order to increase your assets. Your Expenses show up positive because that is where the @@ -665,17 +785,28 @@ flow. A positive cash flow means you are spending more than you make, since income is always a negative figure. To see your current cash flow, use this command: -@smallexample +@smallexample @c command:DB128F3,with_input:6B43DD4 $ ledger balance ^income ^expenses @end smallexample +@smallexample @c output:DB128F3 + $25.00 Expenses:Dining + $-500.00 Income:Salary +-------------------- + $-475.00 +@end smallexample + Another common question to ask of your expenses is: How much do I spend each month on X? Ledger provides a simple way of displaying monthly totals for any account. Here is an example that summarizes your monthly automobile expenses: -@smallexample -$ ledger -M register expenses:auto +@smallexample @c command:DB524E4 +$ ledger -M register -f drewr3.dat expenses:auto +@end smallexample + +@smallexample @c output:DB524E4 +11-Jan-01 - 11-Jan-31 Expenses:Auto $ 5,500.00 $ 5,500.00 @end smallexample This assumes, of course, that you use account names like @@ -699,7 +830,7 @@ This is fairly easy to do in ledger. When spending the money, spend it @emph{to} your Assets:Reimbursements, using a different account for each person or business that you spend money for. For example: -@smallexample +@smallexample @c input:validate 2004/09/29 Circuit City Assets:Reimbursements:Company XYZ $100.00 Liabilities:MasterCard @@ -710,7 +841,7 @@ expense was made on behalf of Company XYZ. Later, when Company XYZ pays the amount back, the money will transfer from that reimbursement account back to a regular asset account: -@smallexample +@smallexample @c input:validate 2004/09/29 Company XYZ Assets:Checking $100.00 Assets:Reimbursements:Company XYZ @@ -732,7 +863,7 @@ company accounts. But keeping them in one file involves the same kinds of postings, so those are what is shown here. First, the personal transaction, which shows the need for reimbursement: -@smallexample +@smallexample @c input:validate 2004/09/29 Circuit City Assets:Reimbursements:Company XYZ $100.00 Liabilities:MasterCard @@ -744,7 +875,7 @@ transaction should be immediately followed by an equivalent transaction, which shows the kind of expense, and also notes the fact that $100.00 is now payable to you: -@smallexample +@smallexample @c input:validate 2004/09/29 Circuit City Company XYZ:Expenses:Computer:Software $100.00 Company XYZ:Accounts Payable:Your Name @@ -757,7 +888,7 @@ paid back. These two transactions can also be merged, to make things a little clearer. Note that all amounts must be specified now: -@smallexample +@smallexample @c input:validate 2004/09/29 Circuit City Assets:Reimbursements:Company XYZ $100.00 Liabilities:MasterCard $-100.00 @@ -771,7 +902,7 @@ paying it to accounts payable, and then drawing it again from the reimbursement account, and paying it to your personal asset account. It's easier shown than said: -@smallexample +@smallexample @c input:validate 2004/10/15 Company XYZ Assets:Checking $100.00 Assets:Reimbursements:Company XYZ $-100.00 @@ -801,7 +932,7 @@ above. For example, for both the expense and the pay-back shown above, the following four transactions would be created. Two in your personal ledger file: -@smallexample +@smallexample @c input:990E0D1 2004/09/29 Circuit City Assets:Reimbursements:Company XYZ $100.00 Liabilities:MasterCard $-100.00 @@ -813,7 +944,7 @@ personal ledger file: And two in your company ledger file: -@smallexample +@smallexample @c input:990E0D1 apply account Company XYZ 2004/09/29 Circuit City @@ -836,6 +967,18 @@ was spent using your MasterCard on behalf of Company XYZ, and that Company XYZ spent the money on computer software and paid it back about two weeks later. +@smallexample @c command:990E0D1 +$ ledger balance --no-total +@end smallexample + +@smallexample @c output:990E0D1 + $100.00 Assets:Checking + 0 Company XYZ + $-100.00 Assets:Checking + $100.00 Expenses:Computer:Software + $-100.00 Liabilities:MasterCard +@end smallexample + @node Commodities and Currencies, Accounts and Inventories, Assets and Liabilities, Principles of Accounting with Ledger @section Commodities and Currencies @@ -886,7 +1029,7 @@ be any commodity, in which case the balance will be computed in terms of that commodity. The usual way to specify prices is with a price history file, which might look like this: -@smallexample +@smallexample @c input:validate P 2004/06/21 02:18:01 FEQTX $22.49 P 2004/06/21 02:18:01 BORL $6.20 P 2004/06/21 02:18:02 AAPL $32.91 @@ -944,7 +1087,7 @@ that commodity on that day. It is also possible, by recording price details in a ledger file, to specify other prices for commodities at any given time. Such price transactions might look like those below: -@smallexample +@smallexample @c input:validate P 2004/06/21 02:17:58 TWCUX $27.76 P 2004/06/21 02:17:59 AGTHX $25.41 P 2004/06/21 02:18:00 OPTFX $39.31 @@ -970,7 +1113,7 @@ transfers an hour of time into a @samp{Billable} account, and another which decreases the same account by ten minutes. The resulting report will indicate that fifty minutes remain: -@smallexample +@smallexample @c input:DF3FEBE 2005/10/01 Work done for company Billable:Client 1h Project:XYZ @@ -982,9 +1125,13 @@ will indicate that fifty minutes remain: Reporting the balance for this ledger file produces: -@smallexample - 50.0m Billable:Client - -50.0m Project:XYZ +@smallexample @c command:DF3FEBE +$ ledger --no-total balance Billable Project +@end smallexample + +@smallexample @c output:DF3FEBE + 50.0m Billable:Client + -50.0m Project:XYZ @end smallexample This example works because ledger already knows how to handle seconds, @@ -993,7 +1140,7 @@ other equivalencies is simple. The following is an example that creates data equivalencies, helpful for tracking bytes, kilobytes, megabytes, and more: -@smallexample +@smallexample @c input:validate C 1.00 Kb = 1024 b C 1.00 Mb = 1024 Kb C 1.00 Gb = 1024 Mb @@ -1021,7 +1168,7 @@ various items in EverQuest, and want to keep track of them using a ledger. Just add items of whatever quantity you wish into your EverQuest account: -@smallexample +@smallexample @c input:48F4E47 9/29 Get some stuff at the Inn Places:Black's Tavern -3 Apples Places:Black's Tavern -5 Steaks @@ -1034,13 +1181,13 @@ Tavern in order to add to your Inventory account. Note that you don't have to use @samp{Places:Black's Tavern} as the source account. You could use @samp{EverQuest:System} to represent the fact that you acquired them online. The only purpose for choosing one kind of -source account over another is for generate more informative reports -later on. The more you know, the better analysis you can perform. +source account over another is to generate more informative reports +later on. The more you know, the better the analysis you can perform. If you later sell some of these items to another player, the transaction would look like: -@smallexample +@smallexample @c input:48F4E47 10/2 Sturm Brightblade EverQuest:Inventory -2 Steaks EverQuest:Inventory 15 Gold @@ -1049,6 +1196,16 @@ transaction would look like: Now you've turned 2 steaks into 15 gold, courtesy of your customer, Sturm Brightblade. +@smallexample @c command:48F4E47 +$ ledger balance EverQuest +@end smallexample + +@smallexample @c output:48F4E47 + 3 Apples + 15 Gold + 3 Steaks EverQuest:Inventory +@end smallexample + @node Understanding Equity, Dealing with Petty Cash, Accounts and Inventories, Principles of Accounting with Ledger @section Understanding Equity @@ -1058,9 +1215,9 @@ account---because starting balances can't come out of nowhere. When you first start your ledger, you will likely already have money in some of your accounts. Let's say there's $100 in your checking account; then add a transaction to your ledger to reflect this amount. -Where will money come from? The answer: your equity. +Where will the money come from? The answer: your equity. -@smallexample +@smallexample @c input:validate 10/2 Opening Balance Assets:Checking $100.00 Equity:Opening Balances @@ -1100,7 +1257,7 @@ One solution is: don't bother. Move your spending to a debit card, but in general ignore cash. Once you withdraw it from the ATM, mark it as already spent to an @samp{Expenses:Cash} category: -@smallexample +@smallexample @c input:validate 2004/03/15 ATM Expenses:Cash $100.00 Assets:Checking @@ -1110,7 +1267,7 @@ If at some point you make a large cash expense that you want to track, just @emph{move} the amount of the expense from @samp{Expenses:Cash} into the target account: -@smallexample +@smallexample @c input:validate 2004/03/20 Somebody Expenses:Food $65.00 Expenses:Cash @@ -1144,7 +1301,7 @@ reserves resources for later: @item Community fund @end itemize -The problem with this kind of setup is that when you spend money, it +The problem with this kind of setup is that, when you spend money, it comes from two or more places at once: the account and the fund. And yet, the correlation of amounts between funds and accounts is rarely one-to-one. What if the school fund has @samp{$500.00}, but @@ -1161,7 +1318,7 @@ This situation can be handled one of two ways. The first is using virtual postings to represent the fact that money is moving to and from two kind of accounts at the same time: -@smallexample +@smallexample @c input:396F24E 2004/03/20 Contributions Assets:Checking $500.00 Income:Donations @@ -1177,7 +1334,7 @@ virtual postings balance to zero. Now money can be spent directly from a fund at the same time as money is drawn from a physical account: -@smallexample +@smallexample @c input:396F24E 2004/03/25 Payment for books (paid from Checking) Expenses:Books $100.00 Assets:Checking $-100.00 @@ -1189,16 +1346,30 @@ funds. In this case, you will likely want to mask out your @samp{Assets} account, because otherwise the balance won't make much sense: -@smallexample -$ ledger bal -^Assets +@smallexample @c command:396F24E +$ ledger --no-total bal not ^Assets +@end smallexample + +@smallexample @c output:396F24E + $100.00 Expenses:Books + $400.00 Funds + $200.00 Building + $200.00 School + $-500.00 Income:Donations @end smallexample @findex --real If the @option{--real} option is used, the report will be in terms of the real accounts: -@smallexample -$ ledger --real bal +@smallexample @c command:2F1CB75,with_input:396F24E +$ ledger --real --no-total bal +@end smallexample + +@smallexample @c output:2F1CB75 + $400.00 Assets:Checking + $100.00 Expenses:Books + $-500.00 Income:Donations @end smallexample If more asset accounts are needed as the source of a posting, just @@ -1218,39 +1389,52 @@ set of postings. Basically, we are associating a transaction with a fund by setting its code. Here are two transactions that deposit money into, and spend money from, the @samp{Funds:School} fund: -@smallexample +@smallexample @c input:AD068BA 2004/03/25 (Funds:School) Donations Assets:Checking $100.00 Income:Donations +2004/03/25 (Funds:Building) Donations + Assets:Checking $20.00 + Income:Donations + 2004/04/25 (Funds:School) Payment for books Expenses:Books $50.00 Assets:Checking @end smallexample Note how the accounts now relate only to the real accounts, and any -balance or registers reports will reflect this. That the transactions +balance or register reports will reflect this. That the transactions relate to a particular fund is kept only in the code. -@findex --code-as-payee +@findex --payee=code @findex --by-payee How does this become a fund report? By using the -@option{--code-as-payee} option, you can generate a register report +@option{--payee=code} option, you can generate a register report where the payee for each posting shows the code. Alone, this is not terribly interesting; but when combined with the @option{--by-payee (-P)} option, you will now see account subtotals for any postings related to a specific fund. So, to see the current monetary balances of all funds, the command would be: -@smallexample -$ ledger --code-as-payee -P reg ^Assets +@smallexample @c command:AD068BA +$ ledger --payee=code -P reg ^Assets +@end smallexample + +@smallexample @c output:AD068BA +04-Mar-25 Funds:Building Assets:Checking $20.00 $20.00 +04-Mar-25 Funds:School Assets:Checking $50.00 $70.00 @end smallexample -Or to see a particular funds expenses, the @samp{School} fund in this +Or to see a particular fund's expenses, the @samp{School} fund in this case: -@smallexample -$ ledger --code-as-payee -P reg ^Expenses @@School +@smallexample @c command:E30B2FC,with_input:AD068BA +$ ledger --payee=code -P reg ^Expenses and code School +@end smallexample + +@smallexample @c output:E30B2FC +04-Apr-25 Funds:School Expenses:Books $50.00 $50.00 @end smallexample Both approaches yield different kinds of flexibility, depending on how @@ -1307,9 +1491,9 @@ posting. @section The Most Basic Entry Here is the Pacific Bell example from above, given as a Ledger -posting, with the additional of a check number: +posting, with the addition of a check number: -@smallexample +@smallexample @c input:validate 9/29 (1023) Pacific Bell Expenses:Utilities:Phone $23.00 Assets:Checking $-23.00 @@ -1321,7 +1505,7 @@ work better with Ledger's scheme of things. In fact, since Ledger is smart about many things, you don't need to specify the balanced amount, if it is the same as the first line: -@smallexample +@smallexample @c input:validate 9/29 (1023) Pacific Bell Expenses:Utilities:Phone $23.00 Assets:Checking @@ -1363,7 +1547,7 @@ basis of the opening entry for ledger. For example if you chose the beginning of 2011 as the date to start tracking finances with ledger, your opening balance entry could look like this: -@smallexample +@smallexample @c input:validate 2011/01/01 * Opening Balance Assets:Joint Checking $800.14 Assets:Other Checking $63.44 @@ -1419,13 +1603,13 @@ Expenses:Food:Hamburgers and Fries Comments are generally started using a @samp{;}. However, in order to increase compatibility with other text manipulation programs and -methods four additional comment characters are valid if used at the +methods, four additional comment characters are valid if used at the beginning of a line: @samp{#}, @samp{|}, and @samp{*} and @samp{%}. Block comments can be made by use @code{comment} ... @code{end comment}. -@smallexample +@smallexample @c input:validate ; This is a single line comment, # and this, % and this, @@ -1440,7 +1624,7 @@ end comment There are several forms of comments within a transaction, for example: -@smallexample +@smallexample @c input:validate ; this is a global comment that is not applied to a specific transaction ; it can start with any of the five characters but is not included in the ; output from 'print' or 'output' @@ -1464,7 +1648,7 @@ start with @samp{;} and are preserved as part of the transaction. The @cindex commodity Ledger is agnostic when it comes to how you value your accounts. -Dollars, Euros, Pounds, Francs, Shares etc. are just ``commodities''. +Dollars, Euros, Pounds, Francs, Shares etc. are all just ``commodities''. Holdings in stocks, bonds, mutual funds and other financial instruments can be labeled using whatever is convenient for you (stock ticker symbols are suggested for publicly traded assets).@footnote{You @@ -1485,41 +1669,44 @@ reporting capabilities to convert all commodities to a single commodity for reporting purposes without ever changing the underlying entry. -For example, the following entries reflect transaction made for a +For example, the following entries reflect transactions made for a business trip to Europe from the US: -@smallexample +@smallexample @c input:82150D9 2011/09/23 Cash in Munich - Assets:Cash E50.00 + Assets:Cash €50.00 Assets:Checking $-66.00 2011/09/24 Dinner in Munich - Expenses:Business:Travel E35.00 + Expenses:Business:Travel €35.00 Assets:Cash @end smallexample This says that $66.00 came out of checking and turned into 50 -Euros. The implied exchange rate was $1.32. Then 35.00 Euros was +Euros. The implied exchange rate was $1.32. Then 35.00 Euros were spent on Dinner in Munich. Running a ledger balance report shows: -@smallexample +@smallexample @c command:82150D9 $ ledger -f example.dat bal +@end smallexample + +@smallexample @c output:82150D9 $-66.00 - E15.00 Assets - E15.00 Cash + €15.00 Assets + €15.00 Cash $-66.00 Checking - E35.00 Expenses:Business:Travel + €35.00 Expenses:Business:Travel -------------------- $-66.00 - E50.00 + €50.00 @end smallexample The top two lines show my current assets as $-66.00 in checking (in this very short example I didn't establish opening an opening balance -for the checking account) and E15.00. After spending on dinner I have -E15.00 in my wallet. The bottom line balances to zero, but is shown +for the checking account) and €15.00. After spending on dinner I have +€15.00 in my wallet. The bottom line balances to zero, but is shown in two lines since we haven't told ledger to convert commodities. @menu @@ -1533,10 +1720,10 @@ in two lines since we haven't told ledger to convert commodities. @subsection Naming Commodities Commodity names can have any character, including white-space. -However, if you include white-space or numeric characters the +However, if you include white-space or numeric characters, the commodity name must be enclosed in double quotes @samp{"}: -@smallexample +@smallexample @c input:validate 1999/06/09 ! Achat Actif:SG PEE STK 49.957 "Arcancia Équilibre 454" Actif:SG PEE STK $-234.90 @@ -1556,22 +1743,22 @@ multiple commodities in the same transaction. The type of the share unit you made the purchase in ($ for AAPL). Yes, the typical convention is as follows: -@smallexample +@smallexample @c input:validate 2004/05/01 Stock purchase Assets:Broker 50 AAPL @@ $30.00 Expenses:Broker:Commissions $19.95 - Assets:Broker $-1,500.00 + Assets:Broker $-1,519.95 @end smallexample -This assumes you have a brokerage account that is capable of managed +This assumes you have a brokerage account that is capable of managing both liquid and commodity assets. Now, on the day of the sale: -@smallexample +@smallexample @c input:validate 2005/08/01 Stock sale - Assets:Broker -50 APPL @{$30.00@} @@ $50.00 + Assets:Broker -50 AAPL @{$30.00@} @@ $50.00 Expenses:Broker:Commissions $19.95 Income:Capital Gains $-1,000.00 - Assets:Broker $2,500.00 + Assets:Broker $2,480.05 @end smallexample @noindent @@ -1588,7 +1775,7 @@ longest-held-first. @cindex fixing lot prices @cindex consumable commodity pricing -Commodities that you keep in order to sell them at a later time have +Commodities that you keep in order to sell at a later time have a variable value that fluctuates with the market prices. Commodities that you consume should not fluctuate in value, but stay at the lot price they were purchased at. As an extension of ``lot pricing'', you @@ -1602,7 +1789,7 @@ reported in terms of today's price. This is supported as follows: -@smallexample +@smallexample @c input:validate 2009/01/01 Shell Expenses:Gasoline 11 GAL @{=$2.299@} Assets:Checking @@ -1614,9 +1801,9 @@ price of gasoline. If you do not want price fixing, you can specify this same transaction in one of two ways, both equivalent (note the lack of the equal sign -from the transaction above): +compared to the transaction above): -@smallexample +@smallexample @c input:validate 2009/01/01 Shell Expenses:Gasoline 11 GAL @{$2.299@} Assets:Checking @@ -1629,7 +1816,7 @@ from the transaction above): There is no difference in meaning between these two forms. Why do both exist, you ask? To support things like this: -@smallexample +@smallexample @c input:validate 2009/01/01 Shell Expenses:Gasoline 11 GAL @{=$2.299@} @@ $2.30 Assets:Checking @@ -1649,12 +1836,12 @@ Assets:Checking because its amount is null. Ledger allows you to have very detailed control over how your commodities are valued. You can fine tune the results given using the @option{--market} or @option{--exchange @var{COMMODITY}} options. There -are now several points of interception, you can specify the valuation +are now several points of interception; you can specify the valuation method: @enumerate @item on a commodity itself, -@item on a posting, via metadata (affect is largely the same as #1), +@item on a posting, via metadata (effect is largely the same as #1), @item on an xact, which then applies to all postings in that xact, @item on any posting via an automated transaction, @item on a per-account basis, @@ -1670,7 +1857,7 @@ A valuation function receives three arguments: @table @code -@item source +@item source A string identifying the commodity whose price is being asked for (example: @samp{EUR}). @@ -1741,7 +1928,7 @@ function on a transaction-wide or per-posting basis. Lastly, you can specify the valuation function/value for any specific amount using the @samp{(( ))} commodity annotation. -@smallexample +@smallexample @c input:814A366 2012-03-02 KFC Expenses:Food2 $1 ((2 EUR)) Assets:Cash2 @@ -1777,20 +1964,24 @@ amount using the @samp{(( ))} commodity annotation. Assets:Cash9 @end smallexample -@smallexample -ledger reg -V food +@smallexample @c command:814A366 +$ ledger reg -V food +@end smallexample + +@smallexample @c output:814A366 12-Mar-02 KFC Expenses:Food2 2 EUR 2 EUR -12-Mar-03 KFC <Adjustment> -1 EUR 1 EUR - Expenses:Food3 3 EUR 4 EUR -12-Mar-04 KFC <Adjustment> -2 EUR 2 EUR - Expenses:Food4 4 EUR 6 EUR -12-Mar-05 KFC <Adjustment> -3 EUR 3 EUR - Expenses:Food5 5 EUR 8 EUR -12-Mar-06 KFC <Adjustment> -4 EUR 4 EUR - Expenses:Food6 6 EUR 10 EUR -12-Mar-07 KFC Expenses:Food7 7 EUR 17 EUR -12-Mar-08 XACT Expenses:Food8 8 EUR 25 EUR -12-Mar-09 POST (Expenses:Food9) 9 EUR 34 EUR +12-Mar-03 KFC Expenses:Food3 3 EUR 5 EUR +12-Mar-04 KFC Expenses:Food4 4 EUR 9 EUR +12-Mar-05 KFC Expenses:Food5 $1 $1 + 9 EUR +12-Mar-06 KFC Expenses:Food6 $1 $2 + 9 EUR +12-Mar-07 KFC Expenses:Food7 1 CAD $2 + 1 CAD + 9 EUR +12-Mar-08 XACT Expenses:Food8 $1 $3 + 1 CAD + 9 EUR @end smallexample @node Keeping it Consistent, Journal Format, Currency and Commodities, Keeping a Journal @@ -1804,8 +1995,8 @@ data, but also easy to enter accounts or payees inconsistently or with spelling errors. In order to combat inconsistency you can define allowable accounts and -or payees. For simplicity, create a separate text file and enter -define accounts a payees like +payees. For simplicity, create a separate text file and define accounts +and payees like @smallexample account Expenses @@ -1831,7 +2022,8 @@ $ ledger accounts >> Accounts.dat @end smallexample @noindent -You will have to edit this file to add the @code{account} directive. +You will have to edit this file to add the @code{account} directive in +front of every line. @node Journal Format, Converting from other formats, Keeping it Consistent, Keeping a Journal @section Journal Format @@ -1875,7 +2067,7 @@ payee, or a description of the posting. The format of each following posting is: @smallexample -ACCOUNT AMOUNT [; NOTE] + ACCOUNT AMOUNT [; NOTE] @end smallexample The @code{ACCOUNT} may be surrounded by parentheses if it is a virtual @@ -1902,24 +2094,24 @@ An automated transaction. A value expression must appear after the equal sign. After this initial line there should be a set of one or more postings, -just as if it were normal transaction. If the amounts of the postings -have no commodity, they will be applied as modifiers to whichever real +just as if it were a normal transaction. If the amounts of the postings +have no commodity, they will be applied as multipliers to whichever real posting is matched by the value expression (@pxref{Automated Transactions}). @item ~ -A period transaction. A period expression must appear after the tilde. +A periodic transaction. A period expression must appear after the tilde. After this initial line there should be a set of one or more -postings, just as if it were normal transaction. +postings, just as if it were a normal transaction. @item ; # % | * -A line beginning with a colon, pound, percent, bar or asterisk +A line beginning with a semicolon, pound, percent, bar or asterisk indicates a comment, and is ignored. Comments will not be returned in a ``print'' response. @item indented ; -If the semi colon is indented and occurs inside a transaction, it is +If the semicolon is indented and occurs inside a transaction, it is parsed as a persistent note for its preceding category. These notes or tags can be used to augment the reporting and filtering capabilities of Ledger. @@ -1938,13 +2130,13 @@ Command directives must occur at the beginning of a line. Use of @samp{!} and @samp{@@} is deprecated. @item account -Pre-declare valid account names. This only has effect if +Pre-declare valid account names. This only has an effect if @option{--strict} or @option{--pedantic} is used (see below). The @code{account} directive supports several optional sub-directives, if they immediately follow the account directive and if they begin with whitespace: -@smallexample +@smallexample @c input:validate account Expenses:Food note This account is all about the chicken! alias food @@ -1956,8 +2148,8 @@ account Expenses:Food @end smallexample The @code{note} sub-directive associates a textual note with the -account. This can be accessed later using the @code{note} valexpr -function in any account context. +account. This can be accessed later using the @code{note} value +expression function in any account context. The @code{alias} sub-directive, which can occur multiple times, allows the alias to be used in place of the full account name anywhere that @@ -1968,13 +2160,13 @@ provides regexes that identify the account if that payee is encountered and an account within its transaction ends in the name "Unknown". Example: -@smallexample +@smallexample @c input:validate 2012-02-27 KFC Expenses:Unknown $10.00 ; Read now as "Expenses:Food" Assets:Cash @end smallexample -The @code{check} and @code{assert} directives warn or error +The @code{check} and @code{assert} directives warn or raise an error (respectively) if the given value expression evaluates to false within the context of any posting. @@ -1988,16 +2180,16 @@ contain only a single posting. @item apply account @c instance_t::master_account_directive -Sets the root for all accounts following the directive. Ledger +Sets the root for all accounts following this directive. Ledger supports a hierarchical tree of accounts. It may be convenient to keep two ``root accounts''. For example you may be tracking your personal finances and your business finances. In order to keep them separate you could preface all personal accounts with @samp{personal:} -and all business account with @samp{business:}. You can easily split -out large groups of transaction without manually editing them using +and all business accounts with @samp{business:}. You can easily split +out large groups of transactions without manually editing them using the account directive. For example: -@smallexample +@smallexample @c input:validate apply account Personal 2011/11/15 Supermarket Expenses:Groceries $ 50.00 @@ -2006,14 +2198,14 @@ apply account Personal Would result in all postings going into @samp{Personal:Expenses:Groceries} and @samp{Personal:Assets:Checking} -until and @samp{end apply account} directive was found. +until an @samp{end apply account} directive was found. @item alias @c instance_t::alias_directive Define an alias for an account name. If you have a deeply nested tree of accounts, it may be convenient to define an alias, for example: -@smallexample +@smallexample @c input:validate alias Dining=Expenses:Entertainment:Dining alias Checking=Assets:Credit Union:Joint Checking Account @@ -2023,9 +2215,42 @@ alias Checking=Assets:Credit Union:Joint Checking Account @end smallexample The aliases are only in effect for transactions read in after the alias -is defined and are effected by @code{account} directives that precede +is defined and are affected by @code{account} directives that precede them. +@smallexample @c command:validate +$ ledger bal --no-total ^Exp +@end smallexample + +@smallexample + $10.00 Expenses:Entertainment:Dining +@end smallexample + +With the option @option{--recursive-aliases}, aliases can refer to other +aliases, the following example produces exactly the same transactions +and account names as the preceding one: + +@smallexample @c input:validate +alias Entertainment=Expenses:Entertainment +alias Dining=Entertainment:Dining +alias Checking=Assets:Credit Union:Joint Checking Account + +2011/11/30 ChopChop + Dining $10.00 + Checking +@end smallexample + +@smallexample @c command:validate +$ ledger balance --no-total --recursive-aliases ^Exp +@end smallexample + +@smallexample + $10.00 Expenses:Entertainment:Dining +@end smallexample + +The option @option{--no-aliases} completely disables alias expansion. +All accounts are read verbatim as they are in the ledger file. + @item assert @c instance_t::assert_directive An assertion can throw an error if a condition is not met during @@ -2040,13 +2265,14 @@ assert <VALUE EXPRESSION BOOLEAN RESULT> Defines the default account to use for balancing transactions. Normally, each transaction has at least two postings, which must balance to zero. Ledger allows you to leave one posting with no -amount and automatically calculate balance the transaction in the +amount and automatically balance the transaction in the posting. The @code{bucket} allows you to fill in all postings and automatically generate an additional posting to the bucket account -balancing the transaction. The following example set the -@samp{Assets:Checking} as the bucket: +balancing the transaction. If any transaction is unbalanced, it +will automatically be balanced against the @code{bucket} account. +The following example sets @samp{Assets:Checking} as the bucket: -@smallexample +@smallexample @c input:validate bucket Assets:Checking 2011/01/25 Tom's Used Cars Expenses:Auto $ 5,500.00 @@ -2066,7 +2292,7 @@ bucket Assets:Checking Directs Ledger to replace any account matching a regex with the given account. For example: -@smallexample +@smallexample @c input:validate capture Expenses:Deductible:Medical Medical @end smallexample @@ -2078,7 +2304,7 @@ Ledger will display the mapped payees in @command{print} and @item check @c instance_t::check_directive in textual.cc -A check can issue a warning if a condition is not met during Ledger's +A check issues a warning if a condition is not met during Ledger's run. @smallexample @@ -2090,19 +2316,19 @@ check <VALUE EXPRESSION BOOLEAN RESULT> Start a block comment, closed by @code{end comment}. @item commodity -Pre-declare commodity names. This only has effect if @option{--strict} -or @option{--pedantic} is used (see below). +Pre-declare commodity names. This only has an effect if +@option{--strict} or @option{--pedantic} is used (see below). -@smallexample +@smallexample @c input:validate commodity $ commodity CAD @end smallexample The @code{commodity} directive supports several optional -sub-directives, if they immediately follow the commodity directive and -if they begin with whitespace: +sub-directives, if they immediately follow the commodity directive +and---if they are on successive lines---begin with whitespace: -@smallexample +@smallexample @c input:validate commodity $ note American Dollars format $1,000.00 @@ -2113,21 +2339,21 @@ commodity $ The @code{note} sub-directive associates a textual note with the commodity. At present this has no value other than documentation. -The @code{format} directive gives you a way to tell Ledger how to -format this commodity. In future using this directive will disable +The @code{format} sub-directive gives you a way to tell Ledger how to +format this commodity. In the future, using this directive will disable Ledger's observation of other ways that commodity is used, and will provide the ``canonical'' representation. -The @code{nomarket} directive states that the commodity's price should -never be auto-downloaded. +The @code{nomarket} sub-directive states that the commodity's price +should never be auto-downloaded. -The @code{default} directive marks this as the ``default'' commodity. +The @code{default} sub-directive marks this as the ``default'' commodity. @item define @c instance_t::define_directive in textual.cc -Allows you to define value expression for future use. For example: +Allows you to define value expressions for future use. For example: -@smallexample +@smallexample @c input:validate define var_name=$100 2011/12/01 Test @@ -2153,21 +2379,21 @@ use when entering many transactions with fixated prices. Thus, the following: -@smallexample +@smallexample @c input:validate fixed CAD $0.90 - 2012-04-10 Lunch in Canada - Assets:Wallet -15.50 CAD - Expenses:Food 15.50 CAD +2012-04-10 Lunch in Canada + Assets:Wallet -15.50 CAD + Expenses:Food 15.50 CAD - 2012-04-11 Second day Dinner in Canada - Assets:Wallet -25.75 CAD - Expenses:Food 25.75 CAD -endfixed +2012-04-11 Second day Dinner in Canada + Assets:Wallet -25.75 CAD + Expenses:Food 25.75 CAD +endfixed CAD @end smallexample is equivalent to this: -@smallexample +@smallexample @c input:validate 2012-04-10 Lunch in Canada Assets:Wallet -15.50 CAD @{=$0.90@} Expenses:Food 15.50 CAD @{=$0.90@} @@ -2190,20 +2416,22 @@ before using the @code{fixed} directive in production. Include the stated file as if it were part of the current file. @item payee -@c instance_t::payee_mapping_directive in textual.cc +@c instance_t::payee_alias_mapping_directive in textual.cc +@c instance_t::payee_uuid_mapping_directive in textual.cc @findex print @findex register -The @code{payee} directive supports one optional sub-directive, if it -immediately follows the payee directive and if it begins with -whitespace: +The @code{payee} directive supports two optional sub-directives, if they +immediately follow the payee directive and---if it is on a successive +line---begins with whitespace: -@smallexample +@smallexample @c input:validate payee KFC alias KENTUCKY FRIED CHICKEN + uuid 2a2e21d434356f886c84371eebac6e44f1337fda @end smallexample -The @code{alias} directive provides a regex which, if it matches +The @code{alias} sub-directive provides a regex which, if it matches a parsed payee, the declared payee name is substituted: @smallexample @@ -2211,6 +2439,14 @@ a parsed payee, the declared payee name is substituted: ... @end smallexample +The @code{uuid} sub-directive specifies that a transaction with exactly +the uuid given should have the declared payee name substituted: + +@smallexample +2014-05-13 UNHELPFUL PAYEE ; will be read as being 'KFC' + ; UUID: 2a2e21d434356f886c84371eebac6e44f1337fda +@end smallexample + Ledger will display the mapped payees in @command{print} and @command{register} reports. @@ -2219,7 +2455,7 @@ Ledger will display the mapped payees in @command{print} and Allows you to designate a block of transactions and assign the same tag to all. Tags can have values and may be nested. -@smallexample +@smallexample @c input:validate apply tag hastag apply tag nestedtag: true @@ -2232,67 +2468,70 @@ apply tag nestedtag: true Expenses:Books $20.00 Liabilities:MasterCard -end apply tag nestedtag +end apply tag 2011/12/01 Sale Assets:Checking:Business $ 30.00 Income:Sales -end apply tag hastag +end apply tag @end smallexample @noindent is the equivalent of: -@smallexample +@smallexample @c input:validate 2011/01/25 Tom's Used Cars - :hastag: - nestedtag: true + ; :hastag: + ; nestedtag: true Expenses:Auto $ 5,500.00 ; :nobudget: Assets:Checking 2011/01/27 Book Store - :hastag: - nestedtag: true + ; :hastag: + ; nestedtag: true Expenses:Books $20.00 Liabilities:MasterCard 2011/12/01 Sale - :hastag: + ; :hastag: Assets:Checking:Business $ 30.00 Income:Sales @end smallexample -Note that anything following @code{end apply tag} is ignored. placing -the name of the tag that is being closed is a simple way to keep -track. +@c TODO: the following paragraph seems to be false, the automated tests +@c fail, if anything appears after end apply tag. + +@c Note that anything following @code{end apply tag} is ignored. placing +@c the name of the tag that is being closed is a simple way to keep +@c track. @item tag -Pre-declares tag names. This only has effect if @option{--strict} or +Pre-declares tag names. This only has an effect if @option{--strict} or @option{--pedantic} is used (see below). -@smallexample +@smallexample @c input:validate tag Receipt tag CSV @end smallexample The @code{tag} directive supports two optional sub-directives, if they -immediately follow the tag directive and if they begin with -whitespace: +immediately follow the tag directive and---if on a successive +line---begin with whitespace: -@smallexample +@smallexample @c input:validate tag Receipt check value =~ /pattern/ assert value != "foobar" @end smallexample -The @code{check} and @code{assert} directives warn or error +The @code{check} and @code{assert} sub-directives warn or error (respectively) if the given value expression evaluates to false within the context of any use of the related tag. In such a context, -``value'' is bound to the value of the tag (which may not be a string -if typed-metadata is used!). Such checks or assertions are not called -if no value is given. +``value'' is bound to the value of the tag (which may be something else +but a string if typed metadata is used!). Such checks or assertions are +not called if no value is given. @item test @c instance_t::comment_directive in textual.cc @@ -2342,7 +2581,7 @@ whichever is seen last is used as the default commodity. For example, to set US dollars as the default commodity, while also setting the thousands flag and decimal flag for that commodity, use: -@smallexample +@smallexample @c input:validate D $1,000.00 @end smallexample @@ -2351,13 +2590,13 @@ Specifies a commodity conversion, where the first amount is given to be equivalent to the second amount. The first amount should use the decimal precision desired during reporting: -@smallexample +@smallexample @c input:validate C 1.00 Kb = 1024 bytes @end smallexample @item I, i, O, o, b, h These four relate to timeclock support, which permits Ledger to read -timelog files. See the timeclock's documentation for more info on the +timelog files. See timeclock's documentation for more info on the syntax of its timelog files. @end table @@ -2464,7 +2703,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:: @@ -2477,7 +2716,7 @@ doing it. The most basic form of transaction is: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Expenses:Food $20.00 Assets:Cash $-20.00 @@ -2489,7 +2728,7 @@ posting specifies what action is taken related to that account. A transaction can have any number of postings: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Expenses:Food $20.00 Assets:Cash $-10.00 @@ -2503,7 +2742,7 @@ The first thing you can do to make things easier is elide amounts. That is, if exactly one posting has no amount specified, Ledger will infer the inverse of the other postings' amounts: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Expenses:Food $20.00 Assets:Cash $-10.00 @@ -2515,7 +2754,7 @@ If the other postings use multiple commodities, Ledger will copy the empty posting N times and fill in the negated values of the various commodities: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Expenses:Food $20.00 Expenses:Tips $2.00 @@ -2527,7 +2766,7 @@ commodities: @noindent This transaction is identical to writing: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Expenses:Food $20.00 Expenses:Tips $2.00 @@ -2545,7 +2784,7 @@ This transaction is identical to writing: You can associate a second date with a transaction by following the primary date with an equals sign: -@smallexample +@smallexample @c input:validate 2012-03-10=2012-03-08 KFC Expenses:Food $20.00 Assets:Cash $-20.00 @@ -2553,8 +2792,8 @@ primary date with an equals sign: What this auxiliary date means is entirely up to you. The only use Ledger has for it is that if you specify @option{--aux-date}, then all -reports and calculations (including pricing) will use the aux date as if -it were the primary date. +reports and calculations (including pricing) will use the auxiliary +date as if it were the primary date. @node Codes, Transaction state, Auxiliary dates, Transactions @section Codes @@ -2564,7 +2803,7 @@ only displayed by the print command. Checking accounts often use codes like DEP, XFER, etc., as well as check numbers. This is to give you a place to put those codes: -@smallexample +@smallexample @c input:validate 2012-03-10 (#100) KFC Expenses:Food $20.00 Assets:Checking @@ -2576,11 +2815,11 @@ you a place to put those codes: @findex --uncleared @findex --pending -A transaction can have a ``state'': cleared, pending, or uncleared. -The default is uncleared. To mark a transaction cleared, put a * -before the payee, and after date or code: +A transaction can have a ``state'': cleared, pending, or uncleared. The +default is uncleared. To mark a transaction cleared, put an asterisk +@samp{*} before the payee, after the date or code: -@smallexample +@smallexample @c input:validate 2012-03-10 * KFC Expenses:Food $20.00 Assets:Cash @@ -2589,14 +2828,14 @@ before the payee, and after date or code: @noindent To mark it pending, use a !: -@smallexample +@smallexample @c input:validate 2012-03-10 ! KFC Expenses:Food $20.00 Assets:Cash @end smallexample What these mean is entirely up to you. The @option{--cleared} option -will limits to reports to only cleared items, while @option{--uncleared} +limits reports to only cleared items, while @option{--uncleared} shows both uncleared and pending items, and @option{--pending} shows only pending items. @@ -2607,7 +2846,7 @@ a reconciliation. When you clear a transaction, that's really just shorthand for clearing all of its postings. That is: -@smallexample +@smallexample @c input:validate 2012-03-10 * KFC Expenses:Food $20.00 Assets:Cash @@ -2616,7 +2855,7 @@ clearing all of its postings. That is: @noindent Is the same as writing: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC * Expenses:Food $20.00 * Assets:Cash @@ -2626,7 +2865,7 @@ Is the same as writing: You can mark individual postings as cleared or pending, in case one ``side'' of the transaction has cleared, but the other hasn't yet: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Liabilities:Credit $100.00 * Assets:Checking @@ -2636,10 +2875,10 @@ You can mark individual postings as cleared or pending, in case one @section Transaction notes After the payee, and after at least one tab or two spaces (or a space -and a tab, which Ledger calls this a ``hard separator''), you may +and a tab, which Ledger calls a ``hard separator''), you may introduce a note about the transaction using the @samp{;} character: -@smallexample +@smallexample @c input:validate 2012-03-10 * KFC ; yum, chicken... Expenses:Food $20.00 Assets:Cash @@ -2649,7 +2888,7 @@ introduce a note about the transaction using the @samp{;} character: Notes can also appear on the next line, so long as that line begins with whitespace: -@smallexample +@smallexample @c input:validate 2012-03-10 * KFC ; yum, chicken... ; and more notes... Expenses:Food $20.00 @@ -2661,12 +2900,12 @@ with whitespace: Assets:Cash @end smallexample -A transaction note is shared by all its postings. This becomes +A transaction's note is shared by all its postings. This becomes significant when querying for metadata (see below). To specify that a note belongs only to one posting, place it after a hard separator after the amount, or on its own line preceded by whitespace: -@smallexample +@smallexample @c input:validate 2012-03-10 * KFC Expenses:Food $20.00 ; posting #1 note Assets:Cash @@ -2690,7 +2929,7 @@ typed metadata with postings and transactions (by which I mean all of a transaction's postings). This metadata can be queried, displayed, and used in calculations. -The are two forms of metadata: tags and tag/value pairs. +The are two forms of metadata: plain tags, and tag/value pairs. @menu * Metadata tags:: @@ -2702,9 +2941,9 @@ The are two forms of metadata: tags and tag/value pairs. @subsection Metadata tags To tag an item, put any word not containing whitespace between two -colons: +colons inside a comment: -@smallexample +@smallexample @c input:validate 2012-03-10 * KFC Expenses:Food $20.00 Assets:Cash @@ -2713,7 +2952,7 @@ colons: You can gang up multiple tags by sharing colons: -@smallexample +@smallexample @c input:validate 2012-03-10 * KFC Expenses:Food $20.00 Assets:Cash @@ -2736,11 +2975,12 @@ used as the payee name for that posting. This affects the @command{register} report, the @command{payees} report, and the @option{--by-payee} option. -This is useful when for example you deposit 4 checks at a time to -the bank. On the bank statement, there is just one amount @samp{$400}, -but you can specify from whom each check came from, as shown by example below: +This is useful when for example you deposit 4 checks at a time to the +bank. On the bank statement, there is just one amount @samp{$400}, but +you can specify from whom each check came from, as shown by example +below: -@smallexample +@smallexample @c input:validate 2010-06-17 Sample Assets:Bank $400.00 Income:Check1 $-100.00 ; Payee: Person One @@ -2769,7 +3009,7 @@ To associate a value with a tag, use the syntax ``Key: Value'', where the value can be any string of characters. Whitespace is needed after the colon, and cannot appear in the Key: -@smallexample +@smallexample @c input:validate 2012-03-10 * KFC Expenses:Food $20.00 Assets:Cash @@ -2783,7 +3023,7 @@ If a metadata tag ends in ::, its value will be parsed as a value expression and stored internally as a value rather than as a string. For example, although I can specify a date textually like so: -@smallexample +@smallexample @c input:validate 2012-03-10 * KFC Expenses:Food $20.00 Assets:Cash @@ -2824,7 +3064,7 @@ reports using @option{--real}. To specify a virtual account, surround the account name with parentheses: -@smallexample +@smallexample @c input:validate 2012-03-10 * KFC Expenses:Food $20.00 Assets:Cash @@ -2835,7 +3075,7 @@ If you want, you can state that virtual postings @emph{should} balance against one or more other virtual postings by using brackets (which look ``harder'') rather than parentheses: -@smallexample +@smallexample @c input:validate 2012-03-10 * KFC Expenses:Food $20.00 Assets:Cash @@ -2850,7 +3090,7 @@ An amount is usually a numerical figure with an (optional) commodity, but it can also be any value expression. To indicate this, surround the amount expression with parentheses: -@smallexample +@smallexample @c input:validate 2012-03-10 * KFC Expenses:Food ($10.00 + $20.00) ; Ledger adds it up for you Assets:Cash @@ -2899,8 +3139,8 @@ A balance assignment has this form: Assets:Cash = $500.00 @end smallexample -This sets the amount of the second posting to whatever it would need -to be for the total in Assets:Cash to be $500.00 after the posting. +This sets the amount of the second posting to whatever it would need to +be for the total in @samp{Assets:Cash} to be $500.00 after the posting. If the resulting amount is not $-20.00 in this case, it is an error. @node Resetting a balance, Balancing transactions, Balance assignments, Balance verification @@ -2910,7 +3150,7 @@ Say your book-keeping has gotten a bit out of date, and your Ledger balance no longer matches your bank balance. You can create an adjustment transaction using balance assignments: -@smallexample +@smallexample @c input:validate 2012-03-10 Adjustment Assets:Cash = $500.00 Equity:Adjustments @@ -2920,7 +3160,7 @@ Since the second posting is also null, it's value will become the inverse of whatever amount is generated for the first posting. This is the only time in ledger when more than one posting's amount -may be empty---and then only because it's not true empty, it is +may be empty---and then only because it's not truly empty, it is indirectly provided by the balance assignment's value. @node Balancing transactions, , Resetting a balance, Balance verification @@ -2935,9 +3175,9 @@ As a consequence of all the above, consider the following transaction: @end smallexample What this says is: set the amount of the posting to whatever value is -needed so that Assets:Brokerage contains 10 AAPL. Then, because this -posting must balance, ensure that its value is zero. This can only be -true if Assets:Brokerage does indeed contain 10 AAPL at that point in +needed so that @samp{Assets:Brokerage} contains 10 AAPL. Then, because +this posting must balance, ensure that its value is zero. This can only +be true if Assets:Brokerage does indeed contain 10 AAPL at that point in the input file. A balanced virtual transaction is used simply to indicate to Ledger that @@ -2948,7 +3188,7 @@ anyway (unless you use a register report with @option{--empty}). @section Posting cost When you transfer a commodity from one account to another, sometimes -it get transformed during the transaction. This happens when you +it gets transformed during the transaction. This happens when you spend money on gas, for example, which transforms dollars into gallons of gasoline, or dollars into stocks in a company. @@ -2956,7 +3196,7 @@ In those cases, Ledger will remember the ``cost'' of that transaction for you, and can use it during reporting in various ways. Here's an example of a stock purchase: -@smallexample +@smallexample @c input:validate 2012-03-10 My Broker Assets:Brokerage 10 AAPL Assets:Brokerage:Cash $-500.00 @@ -2964,7 +3204,7 @@ example of a stock purchase: This is different from transferring 10 AAPL shares from one account to another, in this case you are @emph{exchanging} one commodity for -another. The resulting posting cost is $50.00 per share. +another. The resulting posting's cost is $50.00 per share. @node Explicit posting costs, Posting cost expressions, Posting cost, Transactions @section Explicit posting costs @@ -2972,16 +3212,16 @@ another. The resulting posting cost is $50.00 per share. You can make any posting's cost explicit using the @samp{@@} symbol after the amount or amount expression: -@smallexample +@smallexample @c input:validate 2012-03-10 My Broker Assets:Brokerage 10 AAPL @@ $50.00 Assets:Brokerage:Cash $-500.00 @end smallexample When you do this, since Ledger can now figure out the balancing amount -from the first posting's cost, you can elide the otheramount: +from the first posting's cost, you can elide the other amount: -@smallexample +@smallexample @c input:validate 2012-03-10 My Broker Assets:Brokerage 10 AAPL @@ $50.00 Assets:Brokerage:Cash @@ -3007,9 +3247,10 @@ Said another way, whenever Ledger sees a posting cost of the form "AMOUNT @@ AMOUNT", the commodity used in the second amount is marked ``primary''. -The only meaning a primary commodity has is that @option{--market (-V)} -flag will never convert a primary commodity into any other commodity. -@option{--exchange @var{COMMODITY} (-X)} still will, however. +The only meaning a primary commodity has is that the @option{--market +(-V)} flag will never convert a primary commodity into any other +commodity. @option{--exchange @var{COMMODITY} (-X)} still will, +however. @node Posting cost expressions, Total posting costs, Explicit posting costs, Transactions @section Posting cost expressions @@ -3017,7 +3258,7 @@ flag will never convert a primary commodity into any other commodity. Just as you can have amount expressions, you can have posting expressions: -@smallexample +@smallexample @c input:validate 2012-03-10 My Broker Assets:Brokerage 10 AAPL @@ ($500.00 / 10) Assets:Brokerage:Cash @@ -3025,7 +3266,7 @@ expressions: You can even have both: -@smallexample +@smallexample @c input:validate 2012-03-10 My Broker Assets:Brokerage (5 AAPL * 2) @@ ($500.00 / 10) Assets:Brokerage:Cash @@ -3038,7 +3279,7 @@ The cost figure following the @samp{@@} character specifies the @emph{per-unit} price for the commodity being transferred. If you'd like to specify the total cost instead, use @samp{@@@@}: -@smallexample +@smallexample @c input:validate 2012-03-10 My Broker Assets:Brokerage 10 AAPL @@@@ $500.00 Assets:Brokerage:Cash @@ -3046,7 +3287,7 @@ like to specify the total cost instead, use @samp{@@@@}: Ledger reads this as if you had written: -@smallexample +@smallexample @c input:validate 2012-03-10 My Broker Assets:Brokerage 10 AAPL @@ ($500.00 / 10) Assets:Brokerage:Cash @@ -3061,17 +3302,17 @@ Ledger's internal price history database. To prevent this from happening in the case of an exceptional transaction, surround the @samp{@@} or @samp{@@@@} with parentheses: -@smallexample +@smallexample @c input:validate 2012-03-10 My Brother Assets:Brokerage 1000 AAPL (@@) $1 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 -When a transaction occurs that exchange one commodity for another, +When a transaction occurs that exchanges one commodity for another, Ledger records that commodity price not only within its internal price database, but also attached to the commodity itself. Usually this fact remains invisible to the user, unless you turn on @option{--lot-prices} @@ -3079,22 +3320,22 @@ to show these hidden price figures. For example, consider the stock sale given above: -@smallexample +@smallexample @c input:validate 2012-03-10 My Broker Assets:Brokerage 10 AAPL @@ $50.00 Assets:Brokerage:Cash @end smallexample -The commodity transferred into Assets:Brokerage is not actually 10 -AAPL, but rather 10 AAPL @{$5.00@}. The figure in braces after the +The commodity transferred into @samp{Assets:Brokerage} is not actually 10 +AAPL, but rather 10 AAPL @{$50.00@}. The figure in braces after the amount is called the ``lot price''. It's Ledger's way of remembering that this commodity was transferred through an exchange, and that -$5.00 was the price of that exchange. +$50.00 was the price of that exchange. This becomes significant if you later sell that commodity again. For example, you might write this: -@smallexample +@smallexample @c input:validate 2012-04-10 My Broker Assets:Brokerage:Cash Assets:Brokerage -10 AAPL @@ $75.00 @@ -3103,7 +3344,7 @@ example, you might write this: And that would be perfectly fine, but how do you track the capital gains on the sale? It could be done with a virtual posting: -@smallexample +@smallexample @c input:validate 2012-04-10 My Broker Assets:Brokerage:Cash Assets:Brokerage -10 AAPL @@ $75.00 @@ -3139,7 +3380,7 @@ As a shorthand, you can specify the total price instead of the per-share price in doubled braces. This goes well with total costs, but is not required to be used with them: -@smallexample +@smallexample @c input:validate 2012-04-10 My Broker Assets:Brokerage:Cash $750.00 Assets:Brokerage -10 AAPL @{@{$500.00@}@} @@@@ $750.00 @@ -3147,12 +3388,12 @@ but is not required to be used with them: @end smallexample It should be noted that this is a convenience only for cases where you -buy and sell whole lots. The @{@{$500.00@}@} is @emph{not} an -attribute of commodity, whereas @{$5.00@} is. In fact, when you write +buy and sell whole lots. The @{@{$500.00@}@} is @emph{not} an attribute +of the commodity, whereas @{$5.00@} is. In fact, when you write @{@{$500.00@}@}, Ledger just divides that value by 10 and sees @{$50.00@}. So if you use the print command to look at this -transaction, you'll see the single form in the output. The double -price form is a shorthand only. +transaction, you'll see the single braces form in the output. The +double braces price form is a shorthand only. Plus, it comes with dangers. This works fine: @@ -3191,12 +3432,12 @@ But this does not do what you might expect: Income:Capital Gains $-125.00 @end smallexample -And in cases where the amounts do not divide into whole figure and +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: @@ -3216,7 +3457,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 @@ -3247,7 +3488,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 @@ -3283,8 +3524,8 @@ indicate a virtual cost: Income:Capital Gains $-125.00 @end smallexample -You can any combination of lot prices, dates or notes, in any order. -They are all optional. +You can specify any combination of lot prices, dates or notes, in any +order. They are all optional. To show all lot information in a report, use @option{--lots}. @@ -3301,7 +3542,7 @@ However, you can override this valuation logic by providing a commodity valuation expression in doubled parentheses. This expression must result in one of two values: either an amount to always be used as the per-share price for that commodity; or -a function taking three argument which is called to determine that +a function taking three arguments, which is called to determine that price. If you use the functional form, you can either specify a function @@ -3356,8 +3597,8 @@ indicate what is being desired. @end itemize In most cases, it is simplest to either use explicit amounts in your -valuation expressions, or just pass the arguments down to market after -modifying them to suit your needs. +valuation expressions, or just pass the arguments down to @samp{market} +after modifying them to suit your needs. @node Automated Transactions, , Lot value expressions, Transactions @section Automated Transactions @@ -3369,7 +3610,7 @@ same query syntax as the Ledger command line. Consider this posting: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Expenses:Food $20.00 Assets:Cash @@ -3377,7 +3618,7 @@ Consider this posting: If I write this automated transaction before it in the file: -@smallexample +@smallexample @c input:validate = expr true Foo $50.00 Bar $-50.00 @@ -3386,7 +3627,7 @@ If I write this automated transaction before it in the file: Then the first transaction will be modified during parsing as if I'd written this: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Expenses:Food $20.00 Foo $50.00 @@ -3423,7 +3664,7 @@ As a special case, if an automated transaction's posting's amount (phew) has no commodity, it is taken as a multiplier upon the matching posting's cost. For example: -@smallexample +@smallexample @c input:validate = expr true Foo 50.00 Bar -50.00 @@ -3435,7 +3676,7 @@ posting's cost. For example: Then the latter transaction turns into this during parsing: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Expenses:Food $20.00 Foo $1000.00 @@ -3453,7 +3694,7 @@ posting, that expression has access to all the details of the matched posting. For example, you can refer to that posting's amount using the ``amount'' value expression variable: -@smallexample +@smallexample @c input:validate = expr true (Foo) (amount * 2) ; same as just "2" in this case @@ -3464,7 +3705,7 @@ the ``amount'' value expression variable: This becomes: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Expenses:Food $20.00 (Foo) $40.00 @@ -3475,11 +3716,12 @@ This becomes: @node Referring to the matching posting's account, Applying metadata to every matched posting, Accessing the matching posting's amount, Automated Transactions @subsection Referring to the matching posting's account -Sometimes want to refer to the account that matched in some way within -the automated transaction itself. This is done by using the string -$account, anywhere within the account part of the automated posting: +Sometimes you want to refer to the account that was matched +in some way within the automated transaction itself. This is +done by using the string @samp{$account}, anywhere within the +account part of the automated posting: -@smallexample +@smallexample @c input:validate = food (Budget:$account) 10 @@ -3490,7 +3732,7 @@ $account, anywhere within the account part of the automated posting: Becomes: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Expenses:Food $20.00 (Budget:Expenses:Food) $200.00 @@ -3504,7 +3746,7 @@ If the automated transaction has a transaction note, that note is copied (along with any metadata) to every posting that matches the predicate: -@smallexample +@smallexample @c input:validate = food ; Foo: Bar (Budget:$account) 10 @@ -3516,7 +3758,7 @@ predicate: Becomes: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Expenses:Food $20.00 ; Foo: Bar @@ -3530,7 +3772,7 @@ Becomes: If the automated transaction's posting has a note, that note is carried to the generated posting within the matched transaction: -@smallexample +@smallexample @c input:validate = food (Budget:$account) 10 ; Foo: Bar @@ -3542,7 +3784,7 @@ carried to the generated posting within the matched transaction: Becomes: -@smallexample +@smallexample @c input:validate 2012-03-10 KFC Expenses:Food $20.00 (Budget:Expenses:Food) $200.00 @@ -3568,7 +3810,7 @@ the generated posting. @cindex effective dates @findex --effective -In the real world transactions do not take place instantaneously. +In the real world, transactions do not take place instantaneously. Purchases can take several days to post to a bank account. And you may pay ahead for something for which you want to distribute costs. With Ledger you can control every aspect of the timing of a transaction. @@ -3578,7 +3820,7 @@ something like @cindex effective date of invoice -@smallexample +@smallexample @c input:validate 2008/01/01=2008/01/14 Client invoice ; estimated date you'll be paid Assets:Accounts Receivable $100.00 Income: Client name @@ -3586,7 +3828,7 @@ something like Then, when you receive the payment, you change it to -@smallexample +@smallexample @c input:validate 2008/01/01=2008/01/15 Client invoice ; actual date money received Assets:Accounts Receivable $100.00 Income: Client name @@ -3595,7 +3837,7 @@ Then, when you receive the payment, you change it to @noindent and add something like -@smallexample +@smallexample @c input:validate 2008/01/15 Client payment Assets:Checking $100.00 Assets:Accounts Receivable @@ -3603,14 +3845,14 @@ and add something like Now -@smallexample +@smallexample @c command:validate $ ledger --begin 2008/01/01 --end 2008/01/14 bal Income @end smallexample @noindent gives you your accrued income in the first two weeks of the year, and -@smallexample +@smallexample @c command:validate $ ledger --effective --begin 2008/01/01 --end 2008/01/14 bal Income @end smallexample @@ -3626,7 +3868,7 @@ the money to be evenly distributed over the next six months so that your monthly budgets gradually take a hit for the vegetables you'll pick up from the co-op, even though you've already paid for them. -@smallexample +@smallexample @c input:6453542 2008/10/16 * (2090) Bountiful Blessings Farm Expenses:Food:Groceries $ 37.50 ; [=2008/10/01] Expenses:Food:Groceries $ 37.50 ; [=2008/11/01] @@ -3637,22 +3879,24 @@ pick up from the co-op, even though you've already paid for them. Assets:Checking @end smallexample -This entry accomplishes this. Every month until you'll start with an +This entry accomplishes this. Every month you'll see an automatic $37.50 deficit like you should, while your checking account really knows that it debited $225 this month. -And using @option{--effective} option, initial date will be overridden -by effective dates. +And using the @option{--effective} option, the initial date will be +overridden by the effective dates. -@smallexample +@smallexample @c command:6453542 $ ledger --effective register Groceries +@end smallexample -08-Oct-01 Bountiful Blessi.. Expe:Food:Groceries $ 37.50 $ 37.50 -08-Nov-01 Bountiful Blessi.. Expe:Food:Groceries $ 37.50 $ 75.00 -08-Dec-01 Bountiful Blessi.. Expe:Food:Groceries $ 37.50 $ 112.50 -09-Jan-01 Bountiful Blessi.. Expe:Food:Groceries $ 37.50 $ 150.00 -09-Feb-01 Bountiful Blessi.. Expe:Food:Groceries $ 37.50 $ 187.50 -09-Mar-01 Bountiful Blessi.. Expe:Food:Groceries $ 37.50 $ 225.00 +@smallexample @c output:6453542 +08-Oct-01 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 37.50 +08-Nov-01 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 75.00 +08-Dec-01 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 112.50 +09-Jan-01 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 150.00 +09-Feb-01 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 187.50 +09-Mar-01 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 225.00 @end smallexample @node Periodic Transactions, Concrete Example of Automated Transactions, Effective Dates, Automated Transactions @@ -3676,9 +3920,9 @@ complex, but if you have further interest, please consult the Web. Ledger makes this otherwise difficult law very easy. Just set up an automated posting at the top of your ledger file: -@smallexample +@smallexample @c input:C371854 ; This automated transaction will compute Huqúqu'lláh based on this -; journal's postings. Any that match will affect the +; journal's postings. Any accounts that match will affect the ; Liabilities:Huququ'llah account by 19% of the value of that posting. = /^(?:Income:|Expenses:(?:Business|Rent$|Furnishings|Taxes|Insurance))/ @@ -3690,12 +3934,24 @@ ledger file. If any match the given value expression, 19% of the posting's value is applied to the @samp{Liabilities:Huququ'llah} account. So, if $1000 is earned from @samp{Income:Salary}, $190 is added to @samp{Liabilities:Huqúqu'lláh}; if $1000 is spent on Rent, -$190 is subtracted. The ultimate balance of Huqúqu'lláh reflects how +$190 is subtracted. + +@smallexample @c input:C371854 +2003/01/01 (99) Salary + Income:Salary -$1000 + Assets:Checking + +2003/01/01 (100) Rent + Expenses:Rent $500 + Assets:Checking +@end smallexample + +The ultimate balance of Huqúqu'lláh reflects how much is owed in order to fulfill one's obligation to Huqúqu'lláh. When ready to pay, just write a check to cover the amount shown in @samp{Liabilities:Huququ'llah}. That transaction would look like: -@smallexample +@smallexample @c input:validate 2003/01/01 (101) Baha'i Huqúqu'lláh Trust Liabilities:Huququ'llah $1,000.00 Assets:Checking @@ -3704,17 +3960,22 @@ When ready to pay, just write a check to cover the amount shown in That's it. To see how much Huqúq is currently owed based on your ledger transactions, use: -@smallexample +@smallexample @c command:C371854 $ ledger balance Liabilities:Huquq @end smallexample -This works fine, but omits one aspect of the law: that Huquq is only +@smallexample @c output:C371854 + $-95 Liabilities:Huququ'llah +@end smallexample + +This works fine, but omits one aspect of the law: that Huqúq is only due once the liability exceeds the value of 19 mithqáls of gold (which is roughly 2.22 ounces). So what we want is for the liability to appear in the balance report only when it exceeds the present day value of 2.22 ounces of gold. This can be accomplished using the command: +@c TODO: fix this, it doesn't work any longer @smallexample $ ledger -Q -t "/Liab.*Huquq/?(a/P@{2.22 AU@}<=@{-1.0@}&a):a" bal liab @end smallexample @@ -3724,6 +3985,7 @@ Huqúqu'lláh is reported only if its value exceeds that of 2.22 ounces of gold. If you wish the liability to be reflected in the parent subtotal either way, use this instead: +@c TODO: fix this, it doesn't work any longer @smallexample $ ledger -Q -T "/Liab.*Huquq/?(O/P@{2.22 AU@}<=@{-1.0@}&O):O" bal liab @end smallexample @@ -3732,7 +3994,7 @@ In some cases, you may wish to refer to the account of whichever posting matched your automated transaction's value expression. To do this, use the special account name @samp{$account}: -@smallexample +@smallexample @c input:validate = /^Some:Long:Account:Name/ [$account] -0.10 [Savings] 0.10 @@ -3777,14 +4039,14 @@ options. The balance report is the most commonly used report. The simplest invocation is: -@smallexample +@smallexample @c command:1D00D56 $ ledger balance -f drewr3.dat @end smallexample @noindent which will print the balances of every account in your journal. -@smallexample +@smallexample @c output:1D00D56 $ -3,804.00 Assets $ 1,396.00 Checking $ 30.00 Business @@ -3807,12 +4069,15 @@ which will print the balances of every account in your journal. $ -243.60 @end smallexample -Most times this is more than you want. Limiting the results to +Most times, this is more than you want. Limiting the results to specific accounts is as easy as entering the names of the accounts -after the command. +after the command: -@smallexample +@smallexample @c command:06B2AD4 $ ledger balance -f drewr3.dat Auto MasterCard +@end smallexample + +@smallexample @c output:06B2AD4 $ 5,500.00 Expenses:Auto $ -20.00 Liabilities:MasterCard -------------------- @@ -3820,14 +4085,17 @@ $ ledger balance -f drewr3.dat Auto MasterCard @end smallexample @noindent -note the implicit logical and between @samp{Auto} and +Note the implicit logical or between @samp{Auto} and @samp{Mastercard}. If you want the entire contents of a branch of your account tree, use the highest common name in the branch: -@smallexample +@smallexample @c command:B0468E1 $ ledger balance -f drewr3.dat Income +@end smallexample + +@smallexample @c output:B0468E1 $ -2,030.00 Income $ -2,000.00 Salary $ -30.00 Sales @@ -3835,18 +4103,28 @@ $ ledger balance -f drewr3.dat Income $ -2,030.00 @end smallexample -You can use general regular expressions in nearly anyplace Ledger +You can use general regular expressions in nearly any place Ledger needs a string: -@smallexample +@smallexample @c command:EAE389F $ ledger balance -f drewr3.dat ^Bo +@end smallexample +@smallexample @c output:EAE389F +@end smallexample + +This first example looks for any account starting with @samp{Bo}, of +which there are none. + +@smallexample @c command:E2AF6AD $ ledger balance -f drewr3.dat Bo +@end smallexample + +@smallexample @c output:E2AF6AD $ 20.00 Expenses:Books @end smallexample -The first example looks for any account starting with @samp{Bo}, of -which there are none. The second looks for any account with @samp{Bo}, -which is @samp{Expenses:Books}. +This second example looks for any account containing @samp{Bo}, which is +@samp{Expenses:Books}. @cindex limit by payees @findex --limit @var{EXPR} @@ -3854,9 +4132,12 @@ which is @samp{Expenses:Books}. If you want to know exactly how much you have spent in a particular account on a particular payee, the following are equivalent: -@smallexample +@smallexample @c command:validate $ ledger balance Auto:Fuel and Chevron -$ ledger balance --limit "(account=~/Fuel/) & (payee=~/Chev/)" +@end smallexample + +@smallexample @c command:validate +$ ledger balance --limit 'account=~/Fuel/' and 'payee=~/Chev/' @end smallexample @noindent @@ -3869,8 +4150,8 @@ possibilities. If you want to exclude specific accounts from the report, you can exclude multiple accounts with parentheses: -@smallexample -$ ledger bal Expenses and not \(Expenses:Drinks or Expenses:Candy or Expenses:Gifts\) +@smallexample @c command:validate +$ ledger bal Expenses and not (Expenses:Drinks or Expenses:Candy or Expenses:Gifts) @end smallexample @node Controlling Formatting, , Controlling the Accounts and Payees, Balance Reports @@ -3886,6 +4167,7 @@ you want, or interface Ledger with other programs. A query such as the following shows all expenses since last October, sorted by total: +@c TODO: does not validate with @c command:validate, because "last oct" is split at the space @smallexample $ ledger -b "last oct" -S T bal ^expenses @end smallexample @@ -3909,7 +4191,7 @@ for all accounts that begin with @samp{expenses}. The following query makes it easy to see monthly expenses, with each month's expenses sorted by the amount: -@smallexample +@smallexample @c command:validate $ ledger -M --period-sort "(amount)" reg ^expenses @end smallexample @@ -3917,7 +4199,7 @@ Now, you might wonder where the money came from to pay for these things. To see that report, add @option{--related (-r)}, which shows the ``related account'' postings: -@smallexample +@smallexample @c command:validate $ ledger -M --period-sort "(amount)" -r reg ^expenses @end smallexample @@ -3927,8 +4209,8 @@ requires the use of a display predicate, since the postings calculated must match @samp{^expenses}, while the postings displayed must match @samp{mastercard}. The command would be: -@smallexample -$ ledger -M -r --display "account =~ /mastercard/" reg ^expenses +@smallexample @c command:validate +$ ledger -M -r --display 'account=~/mastercard/' reg ^expenses @end smallexample This query says: Report monthly subtotals; report the ``related @@ -3936,10 +4218,10 @@ account'' postings; display only related postings whose account matches @samp{mastercard}, and base the calculation on postings matching @samp{^expenses}. -This works just as well for report the overall total, too: +This works just as well for reporting the overall total, too: -@smallexample -$ ledger -s -r --display "account =~ /mastercard/" reg ^expenses +@smallexample @c command:validate +$ ledger -s -r --display "account=~/mastercard/" reg ^expenses @end smallexample The @option{--subtotal (-s)} option subtotals all postings, just as @@ -3965,11 +4247,11 @@ allocation in ledger is not difficult but does require some additional effort to describe how the various assets you own contribute to the asset classes you want to track. -In our simple example we assume you want to apportion you assets into +In our simple example we assume you want to apportion your assets into the general categories of domestic and international equities (stocks) -and a combined category of bonds and cash. For illustrative purposes +and a combined category of bonds and cash. For illustrative purposes, we will use several publicly available mutual funds from Vanguard. -the three funds we will track are the Vanguard 500 IDX FD Signal +The three funds we will track are the Vanguard 500 IDX FD Signal (VIFSX), the Vanguard Target Retirement 2030 (VTHRX), and the Vanguard Short Term Federal Fund (VSGBX). Each of these funds allocates assets to different categories of the investment universe and in different @@ -4002,7 +4284,7 @@ actual balances. For the three instruments listed above, those automatic transactions would look like: -@smallexample +@smallexample @c input:validate ; ; automatic calculations for asset allocation tracking ; @@ -4034,6 +4316,7 @@ the various asset classes how do we get a report that tells us our current allocation? Using the balance command and some tricky formatting! +@c TODO: does not @c command:validate due to multiple lines @smallexample ledger bal Allocation --current --format "\ %-17((depth_spacer)+(partial_account))\ @@ -4063,7 +4346,7 @@ tree, using a special formatter. The magic is in the formatter. The second line simply tells Ledger to print the partial account name indented by its depth in the tree. The third line is where we calculate and display the percentages. The -@code{display_total} command give the values of the total calculated +@code{display_total} command gives the values of the total calculated for the account in this line. The @code{parent.total} command gives the total for the next level up in the tree. @code{percent} formats their ratio as a percentage. The fourth line tells ledger to display @@ -4080,7 +4363,7 @@ nothing. @findex --limit @var{EXPR} @findex --display @var{EXPR} -If you have ``Gnuplot'' program installed, you can graph any of the +If you have the ``Gnuplot'' program installed, you can graph any of the above register reports. The script to do this is included in the ledger distribution, and is named @file{contrib/report}. Install @file{report} anywhere along your @env{PATH}, and then use @file{report} instead of @@ -4119,11 +4402,12 @@ report -J -l "Ua>=@{\$0.01@}" -d "d>=[last feb]" reg ^assets ^liab The last report uses both a calculation predicate @option{--limit @var{EXPR} (-l)} and a display predicate @option{--display @var{EXPR} -(-d)}. The calculation predicates limits the report to postings whose -amount is greater than $1 (which can only happen if the posting amount -is in dollars). The display predicate limits the transactions -@emph{displayed} to just those since last February, even those -transactions from before then will be computed as part of the balance. +(-d)}. The calculation predicate limits the report to postings whose +amount is greater than or equal to $1 (which can only happen if the +posting amount is in dollars). The display predicate limits the +transactions @emph{displayed} to just those since last February, even +though those transactions from before will be computed as part of the +balance. @node Reporting Commands, Command-line Syntax, Building Reports, Top @chapter Reporting Commands @@ -4158,7 +4442,7 @@ separately. @subsection The @command{equity} command @findex equity -The @command{equity} command prints out accounts balances as if they +The @command{equity} command prints out account balances as if they were transactions. This makes it easy to establish the starting balances for an account, such as when @ref{Archiving Previous Years}. @@ -4168,11 +4452,11 @@ balances for an account, such as when @ref{Archiving Previous Years}. @findex --amount-data @findex --total-data -The @command{register} command displays all the postings occurring -in a single account, line by line. The account regex must be -specified as the only argument to this command. If any regexes occur -after the required account name, the register will contain only those -postings that match. Very useful for hunting down a particular +The @command{register} command displays all the postings occurring in +a single account, line by line. The account regex must be specified as +the only argument to this command. If any regexes occur after the +required account name, the register will contain only those postings +that match, which makes it very useful for hunting down a particular posting. The output from @command{register} is very close to what a typical @@ -4184,8 +4468,8 @@ If you have ``Gnuplot'' installed, you may plot the amount or running total of any register by using the script @file{report}, which is included in the Ledger distribution. The only requirement is that you add either @option{--amount-data (-j)} or @option{--total-data (-J)} to -your register command, in order to plot either the amount or total -column, respectively. +your @command{register} command, in order to plot either the amount or +total column, respectively. @node The @command{print} command, , The @command{register} command, Primary Financial Reports @subsection The @command{print} command @@ -4225,12 +4509,12 @@ file whose formatting has gotten out of hand. @subsubsection The @command{csv} command @findex csv -The @command{csv} command will output print out the desired ledger -transactions in a csv format suitable for import into other programs. +The @command{csv} command prints the desired ledger +transactions in a csv format suitable for importing into other programs. You can specify the transactions to print using all the normal limiting and searching functions. -@node The @command{convert} command, , The @command{csv} command, Comma Separated Values files +@node The @command{convert} command, , The @command{csv} command, Comma Separated Values files @subsubsection The @command{convert} command @cindex csv importing @cindex comma separated variable file reading @@ -4238,12 +4522,12 @@ limiting and searching functions. @findex --input-date-format @var{DATE_FORMAT} The @command{convert} command parses a comma separated value (csv) file -and outputs Ledger transactions. Many banks offer csv file downloads. -Unfortunately, the file formats, aside the from commas, are all +and prints Ledger transactions. Many banks offer csv file downloads. +Unfortunately, the file formats, aside from the commas, are all different. The ledger @command{convert} command tries to help as much as it can. -Your banks csv files will have fields in different orders from other +Your bank's csv files will have fields in different orders from other banks, so there must be a way to tell Ledger what to expect. Insert a line at the beginning of the csv file that describes the fields to Ledger. @@ -4266,9 +4550,10 @@ Transaction Number,Date,Description,Memo,Amount Debit,Amount Credit,Balance,Chec Unfortunately, as it stands Ledger cannot read it, but you can. Ledger expects the first line to contain a description of the fields on each -line of the file. The fields ledger can recognize are called -@code{date}, @code{posted}, @code{code}, @code{payee} or @code{desc}, -@code{amount}, @code{cost}, @code{total}, and @code{note}. +line of the file. The fields ledger can recognize contain these +case-insensitive strings @code{date}, @code{posted}, @code{code}, +@code{payee} or @code{desc} or @code{description}, @code{amount}, +@code{cost}, @code{total}, and @code{note}. Delete the account description lines at the top, and replace the first line in the data above with: @@ -4286,7 +4571,7 @@ $ ledger convert download.csv --input-date-format "%m/%d/%Y" Where the @option{--input-date-format @var{DATE_FORMAT}} option tells ledger how to interpret the dates. -Importing csv files is a lot of work, and but is very amenable to +Importing csv files is a lot of work, but is very amenable to scripting. If there are columns in the bank data you would like to keep in your @@ -4301,20 +4586,20 @@ transid,date,payee,note,amount,,,code, @end smallexample Ledger will include @samp{; transid: 767718} in the first transaction -is from the file above. +from the file above. @findex --invert @findex --account @var{STR} @findex --rich-data -The @command{convert} command accepts three options, the most important -ones are @option{--invert} which inverts the amount field, and +The @command{convert} command accepts three options. They are +@option{--invert} which inverts the amount field, @option{--account @var{STR}} which you can use to specify the account to -balance against and @option{--rich-data}. When using the rich-data -switch additional metadata is stored as tags. There is, for example, +balance against, and @option{--rich-data} which stores +additional metadata as tags. There is, for example, a UUID field. If an entry with the same UUID tag is already included in the normal ledger file (specified via @option{--file @var{FILE} (-f)} or -via environment variable @env{LEDGER_FILE}) this entry will not be +via the environment variable @env{LEDGER_FILE}) this entry will not be printed again. You can also use @command{convert} with @code{payee} and @code{account} @@ -4323,7 +4608,7 @@ directive to rewrite the @code{payee} field based on some rules. Then you can use the account and its @code{payee} directive to specify the account. I use it like this, for example: -@smallexample +@smallexample @c input:validate payee Aldi alias ^ALDI SUED SAGT DANKE account Aufwand:Einkauf:Lebensmittel @@ -4332,7 +4617,7 @@ account Aufwand:Einkauf:Lebensmittel Note that it may be necessary for the output of @samp{ledger convert} to be passed through @code{ledger print} a second time if you want to -match on the new payee field. During the @code{ledger convert} run +match on the new payee field. During the @code{ledger convert} run, only the original payee name as specified in the csv data seems to be used. @@ -4341,7 +4626,7 @@ used. @findex lisp @findex emacs -The @command{lisp} command outputs results in a form that can be read +The @command{lisp} command prints results in a form that can be read directly by Emacs Lisp. The format of the @code{sexp} is: @smallexample @@ -4372,7 +4657,7 @@ commands also appear in the text file. The output can be updated whenever any new ledger entries are added. For instance, the following Org mode text document snippet illustrates -a very naive but still useful of the Babel system: +a very naive but still useful application of the Babel system: @smallexample * A simple test of ledger in an org file @@ -4418,7 +4703,7 @@ Using Babel, it is possible to record financial transactions conveniently in an org file and subsequently generate the financial reports required. -As of Org-mode 7.01, Ledger support is provided. Check the Babel +As of Org mode 7.01, Ledger support is provided. Check the Babel documentation on Worg for instructions on how to achieve this but I currently do this directly as follows: @@ -4429,7 +4714,7 @@ I currently do this directly as follows: )) @end smallexample -Once Ledger support in Babel has been enabled, we can use proceed to +Once Ledger support in Babel has been enabled, we can proceed to include Ledger entries within an org file. There are three ways (at least) in which these can be included: @@ -4467,7 +4752,7 @@ The first two are described in more detail in this short tutorial. @node Embedded Ledger example with single source block, Multiple Ledger source blocks with @code{noweb}, Org mode with Babel, Org mode with Babel @subsubsection Embedded Ledger example with single source block -The easiest, albeit possibly less useful, way in which to use Ledger +The easiest, albeit possibly least useful, way in which to use Ledger within an org file is to use a single source block to record all Ledger entries. The following is an example source block: @@ -4706,10 +4991,10 @@ the running total of the assets in our ledger. @node Summary, , Generating a monthly register, Org mode with Babel @subsubsection Summary -This short tutorial shows how Ledger entries can be embedded in a org +This short tutorial shows how Ledger entries can be embedded in an org file and manipulated using Babel. However, only simple Ledger features have been illustrated; please refer to the Ledger documentation for -examples of more complex operations with a ledger. +examples of more complex operations on a ledger. @node The @command{pricemap} command, The @command{xml} command, Org mode with Babel, Reports in other Formats @subsection The @command{pricemap} command @@ -4721,7 +5006,7 @@ commodities. The output file is in the ``dot'' format. This is probably not very interesting, unless you have many different commodities valued in terms of each other. For example, multiple -currencies and multiples investments valued in those currencies. +currencies and multiple investments valued in those currencies. @node The @command{xml} command, @command{prices} and @command{pricedb} commands, The @command{pricemap} command, Reports in other Formats @subsection The @command{xml} command @@ -4744,7 +5029,7 @@ The general format used for Ledger data is: @end smallexample The data stream is enclosed in a @code{ledger} tag, which contains a -series of one or more transactions. Each @code{xact} describes the +series of one or more transactions. Each @code{xact} describes one transaction and contains a series of one or more postings: @smallexample @@ -4789,7 +5074,7 @@ Within the @code{en:postings} tag is a series of one or more </posting> @end smallexample -This is a basic posting. It may also be begin with +This is a basic posting. It may also begin with @code{tr:virtual} and/or @code{tr:generated} tags, to indicate virtual and auto-generated postings. Then follows the @code{tr:account} tag, which contains the full name of the account the posting is @@ -4891,7 +5176,7 @@ report, to display the running average price, or @option{--deviation (-D)} to show each price's deviation from that average. There is also a @command{pricedb} command which outputs the same -information as @command{prices}, but does in a format that can be +information as @command{prices}, but does so in a format that can be parsed by Ledger. This is useful for generating and tidying up pricedb database files. @@ -4913,18 +5198,20 @@ pricedb database files. @subsection @command{accounts} @findex accounts -The @command{accounts} reports all of the accounts in the journal. -Following the command with a regular expression will limit the output to -accounts matching the regex. The output is sorted by name. Using the -@option{--count} option will tell you how many entries use each account. +The @command{accounts} command reports all of the accounts in the +journal. Following the command with a regular expression will limit the +output to accounts matching the regex. The output is sorted by name. +Using the @option{--count} option will tell you how many entries use +each account. @node @command{payees}, @command{commodities}, @command{accounts}, Reports about your Journals @subsection @command{payees} @findex payees -The @command{payees} reports all of the unique payees in the journal. -Using the @option{--count} option will tell you how many entries use -each payee. To filter the payees displayed you must use the prefix: +The @command{payees} command reports all of the unique payees in the +journal. Using the @option{--count} option will tell you how many +entries use each payee. To filter the payees displayed you must use the +prefix @@: @smallexample $ ledger payees @@Nic @@ -4947,10 +5234,10 @@ you how many entries use each commodity. @findex tags @findex --values -The @command{tags} reports all of the tags in the journal. The output -is sorted by name. Using the @option{--count} option will tell you how -many entries use each tag. Using the @option{--values} option will -report the values used by each tag. +The @command{tags} command reports all of the tags in the journal. The +output is sorted by name. Using the @option{--count} option will tell +you how many entries use each tag. Using the @option{--values} option +will report the values used by each tag. @node @command{xact}, @command{stats}, @command{tags}, Reports about your Journals @subsection @command{xact} @@ -4958,34 +5245,34 @@ report the values used by each tag. @findex entry @findex xact -The @command{xact} command simplify the creation of new transactions. +The @command{xact} command simplifies the creation of new transactions. It works on the principle that 80% of all postings are variants of earlier postings. Here's how it works: Say you currently have this posting in your ledger file: -@smallexample +@smallexample @c input:03ACB97 2004/03/15 * Viva Italiano Expenses:Food $12.45 Expenses:Tips $2.55 Liabilities:MasterCard $-15.00 @end smallexample -Now it's @samp{2004/4/9}, and you've just eating at @samp{Viva Italiano} +Now it's @samp{2004/4/9}, and you've just eaten at @samp{Viva Italiano} again. The exact amounts are different, but the overall form is the same. With the @command{xact} command you can type: -@smallexample +@smallexample @c command:03ACB97 $ ledger xact 2004/4/9 viva food 11 tips 2.50 @end smallexample This produces the following output: -@smallexample +@smallexample @c output:03ACB97 2004/04/09 Viva Italiano - Expenses:Food $11.00 - Expenses:Tips $2.50 - Liabilities:MasterCard $-13.50 + Expenses:Food $11.00 + Expenses:Tips $2.50 + Liabilities:MasterCard @end smallexample It works by finding a past posting matching the regular expression @@ -5037,7 +5324,7 @@ FIX THIS ENTRY @c FIXME thdox @section Basic Usage This chapter describes Ledger's features and options. You may wish to -survey this to get an overview before diving in to the @ref{Ledger +survey this to get an overview before diving into the @ref{Ledger Tutorial} and more detailed examples that follow. Ledger has a very simple command-line interface, named---enticingly @@ -5062,14 +5349,14 @@ instead, precede the regular expression with @samp{payee} or totals for rent, food and movies, but only those whose payee matches Freddie: -@smallexample +@smallexample @c command:validate $ ledger bal rent food movies payee freddie @end smallexample @noindent or -@smallexample +@smallexample @c command:validate $ ledger bal rent food movies @@freddie @end smallexample @@ -5077,7 +5364,7 @@ There are many, many command options available with the @file{ledger} program, and it takes a while to master them. However, none of them are required to use the basic reporting commands. -@node Command Line Quick Reference, Detailed Option Description, Basic Usage, Command-line Syntax +@node Command Line Quick Reference, Detailed Option Description, Basic Usage, Command-line Syntax @section Command Line Quick Reference @menu @@ -5090,7 +5377,7 @@ required to use the basic reporting commands. * Commodity Reporting:: @end menu -@node Basic Reporting Commands, Basic Options, Command Line Quick Reference, Command Line Quick Reference +@node Basic Reporting Commands, Basic Options, Command Line Quick Reference, Command Line Quick Reference @subsection Basic Reporting Commands @ftable @code @@ -5108,14 +5395,14 @@ Show all transactions with running total. Show transactions in csv format, for exporting to other programs. @item print -Print transaction in a ledger readable format. +Print transactions in a format readable by ledger. @item xml Produce XML output of the register command. @item lisp @itemx emacs -Produce Emacs lisp output. +Produce s-expression output, suitable for Emacs. @item equity Print account balances as transactions. @@ -5124,7 +5411,8 @@ Print account balances as transactions. Print price history for matching commodities. @item pricedb -Print price history for matching commodities in ledger readable format. +Print price history for matching commodities in a format readable by +ledger. @item xact Generate transactions based on previous postings. @@ -5142,7 +5430,7 @@ Print summary of all options. @item --version @itemx -v -Print version of ledger executable. +Print version information and exit. @item --file @var{FILE} @itemx -f @var{FILE} @@ -5154,7 +5442,7 @@ Redirect output to @file{FILE}. @item --init-file @var{FILE} @itemx -i @var{FILE} -Specify options file. +Specify an options file. @item --account @var{STR} @itemx -a @var{STR} @@ -5169,22 +5457,22 @@ Specify default account @var{STR} for QIF file postings. @item --current @itemx -c -Display transaction on or before the current date. +Display only transactions on or before the current date. @item --begin @var{DATE} @itemx -b @var{DATE} -Begin reports on or after @var{DATE}. +Limit the processing to transactions on or after @var{DATE}. @item --end @var{DATE} @itemx -e @var{DATE} -Limit end date of transactions for report. +Limit the processing to transactions before @var{DATE}. @item --period @var{PERIOD_EXPRESSION} @itemx -p @var{PERIOD_EXPRESSION} -Set report period to @var{PERIOD_EXPRESSION}. +Limit the processing to transactions in @var{PERIOD_EXPRESSION}. @item --period-sort @var{VEXPR} -Sort postings within each period. +Sort postings within each period according to @var{VEXPR}. @item --cleared @itemx -C @@ -5203,7 +5491,7 @@ Display only real postings. @item --actual @itemx -L -Display only actual postings, not automated. +Display only actual postings, not automated ones. @item --related @itemx -r @@ -5213,17 +5501,17 @@ Display related postings. Display how close your postings meet your budget. @item --add-budget -Show un-budgeted postings. +Show unbudgeted postings. @item --unbudgeted -Show only un-budgeted postings. +Show only unbudgeted postings. @item --forecast @var{VEXPR} Project balances into the future. @item --limit @var{EXPR} @itemx -l @var{EXPR} -Limit postings in calculations. +Limit which postings are used in calculations by @var{EXPR}. @item --amount @var{EXPR} @itemx -t @var{EXPR} @@ -5250,7 +5538,8 @@ Accounts, tags or commodities not previously declared will cause errors. @item --check-payees Enable strict and pedantic checking for payees as well as accounts, -commodities and tags. +commodities and tags. This only works in conjunction with +@option{--strict} or @option{--pedantic}. @item --immediate Instruct ledger to evaluate calculations immediately rather than lazily. @@ -5276,18 +5565,21 @@ Report subtotals by payee. @item --empty @itemx -E -Include empty accounts in report. +Include empty accounts in the report. @item --weekly @itemx -W Report posting totals by week. +@item --quarterly +Report posting totals by quarter. + @item --yearly @itemx -Y Report posting totals by year. @item --dow -Report Posting totals by day of week. +Report posting totals by day of week. @item --sort @var{VEXPR} @itemx -S @var{VEXPR} @@ -5308,11 +5600,11 @@ Direct output to @var{FILE} pager program. @item --average @itemx -A -Report average posting value. +Report the average posting value. @item --deviation @itemx -D -Report each posting deviation from the average. +Report each posting's deviation from the average. @item --percent @itemx -% @@ -5325,21 +5617,21 @@ Produce a pivot table of the @var{TAG} type specified. @item --amount-data @itemx -j -Show only date and value column to format the output for plots. +Show only the date and value columns to format the output for plots. @item --plot-amount-format @var{FORMAT_STRING} Specify the format for the plot output. @item --total-data @itemx -J -Show only dates and totals to format the output for plots. +Show only the date and total columns to format the output for plots. @item --plot-total-format @var{FORMAT_STRING} Specify the format for the plot output. @item --display @var{EXPR} @itemx -d @var{EXPR} -Display only posting that meet the criterias in the @var{EXPR}. +Display only postings that meet the criteria in the @var{EXPR}. @item --date-format @var{DATE_FORMAT} @itemx -y @var{DATE_FORMAT} @@ -5350,11 +5642,7 @@ Change the basic date format used in reports. @itemx --register-format @var{FORMAT_STRING} @itemx --prices-format @var{FORMAT_STRING} @itemx -F @var{FORMAT_STRING} -Set reporting format. - -@item --wide -@itemx -w -Wide. +Set the reporting format for various reports. @item --anon Print the ledger register with anonymized accounts and payees, useful @@ -5395,7 +5683,7 @@ Group by day of weeks. @item --subtotal @itemx -s -Group posting together, similar to balance report. +Group postings together, similar to the balance report. @end ftable @@ -5413,10 +5701,10 @@ Set expected freshness of prices in @var{INT} minutes. @item --download @itemx -Q -Download quotes using named @file{getquote}. +Download quotes using the script named @file{getquote}. @item --getquote @var{FILE} -Sets path to a user defined script to download commodity prices. +Sets the path to a user-defined script to download commodity prices. @item --quantity @itemx -O @@ -5432,11 +5720,11 @@ Report last known market value. @item --gain @itemx -G -Report net gain loss for commodities that have a price history. +Report net gain or loss for commodities that have a price history. @end ftable -@node Detailed Option Description, Period Expressions, Command Line Quick Reference, Command-line Syntax +@node Detailed Option Description, Period Expressions, Command Line Quick Reference, Command-line Syntax @section Detailed Option Description @menu @@ -5453,7 +5741,7 @@ Report net gain loss for commodities that have a price history. @node Global Options, Session Options, Detailed Option Description, Detailed Option Description @subsection Global Options -Options for Ledger report affect three separate scopes of operation: +Options for Ledger reports affect three separate scopes of operation: Global, Session, and Report. In practice there is very little difference between these scopes. Ledger 3.0 contains provisions for GUIs, which would make use of the different scopes by keeping an @@ -5464,8 +5752,8 @@ sessions with multiple reports per session. @item --args-only Ignore all environment and init-file settings and -use only command-line arguments to control Ledger. Useful for debugs -or testing small Journal files not associated with you main financial +use only command-line arguments to control Ledger. Useful for debugging +or testing small journal files not associated with your main financial database. @item --debug @var{CODE} @@ -5473,7 +5761,7 @@ FIX THIS ENTRY @c FIXME thdox @item --help @itemx -h -Display the info page for ledger. +Display the man page for ledger. @item --init-file @var{FILE} Specify the location of the init file. The default is @file{~/.ledgerrc}. @@ -5513,7 +5801,7 @@ $ ledger --options bal --cleared -f ~/ledger/test/input/drewr3.dat @noindent For the source column, a value starting with a @samp{-} or @samp{--} -indicated the source was a command line argument. It the entry starts +indicated the source was a command line argument. If the entry starts with a @samp{$}, the source was an environment variable. If the source is @code{?normalize} the value was set internally by ledger, in a function called @code{normalize_options}. @@ -5542,7 +5830,7 @@ FIX THIS ENTRY @c FIXME thdox @node Session Options, Report Options, Global Options, Detailed Option Description @subsection Session Options -Options for Ledger report affect three separate scopes of operation: +Options for Ledger reports affect three separate scopes of operation: Global, Session, and Report. In practice there is very little difference between these scopes. Ledger 3.0 contains provisions for GUIs, which would make use of the different scopes by keeping an @@ -5562,11 +5850,11 @@ FIX THIS ENTRY @c FIXME thdox @item --decimal-comma Direct Ledger to parse journals using the European standard comma as -decimal separator, vice a period. +a decimal separator, not the usual period. @item --download @itemx -Q -Direct Ledger to download prices using the script defined in +Direct Ledger to download prices using the script defined via the option @option{--getquote @var{FILE}}. @item --explicit @@ -5596,22 +5884,23 @@ Format Codes}). @item --master-account @var{STR} Prepend all account names with the argument. -@smallexample -$ ledger -f test/input/drewr3.dat bal --master-account HUMBUG +@smallexample @c command:A76BB56 +$ ledger -f drewr3.dat bal --no-total --master-account HUMBUG +@end smallexample + +@smallexample @c output:A76BB56 0 HUMBUG $ -3,804.00 Assets $ 1,396.00 Checking $ 30.00 Business $ -5,200.00 Savings - $ 20.00 Books $ -1,000.00 Equity:Opening Balances - $ 6,634.00 Expenses - $ 11,000.00 Auto + $ 6,654.00 Expenses + $ 5,500.00 Auto $ 20.00 Books $ 300.00 Escrow $ 334.00 Food:Groceries $ 500.00 Interest:Mortgage - $ -5,520.00 Assets:Checking $ -2,030.00 Income $ -2,000.00 Salary $ -30.00 Sales @@ -5620,8 +5909,11 @@ $ ledger -f test/input/drewr3.dat bal --master-account HUMBUG $ 200.00 Mortgage:Principal @end smallexample +@item --no-aliases +Ledger does not expand any aliases if this option is specified. + @item --pedantic -FIX THIS ENTRY @c FIXME thdox +Accounts, tags or commodities not previously declared will cause errors. @item --permissive FIX THIS ENTRY @c FIXME thdox @@ -5640,13 +5932,18 @@ considered to be fresh enough. @item --strict Ledger normally silently accepts any account or commodity in a posting, -even if you have misspelled a common used one. The option -@option{--strict} changes that behavior. While running +even if you have misspelled a commonly used one. The option +@option{--strict} changes that behavior. While running with @option{--strict}, Ledger interprets all cleared transactions as -correct, and if it finds a new account or commodity (same as +correct, and if it encounters a new account or commodity (same as a misspelled commodity or account) it will issue a warning giving you the file and line number of the problem. +@item --recursive-aliases +Normally, ledger only expands aliases once. With this option, ledger +tries to expand the result of alias expansion recursively, until no more +expansions apply. + @item --time-colon The @option{--time-colon} option will display the value for a seconds based commodity as real hours and minutes. @@ -5662,7 +5959,7 @@ FIX THIS ENTRY @c FIXME thdox @node Report Options, Basic options, Session Options, Detailed Option Description @subsection Report Options -Options for Ledger report affect three separate scopes of operation: +Options for Ledger reports affect three separate scopes of operation: Global, Session, and Report. In practice there is very little difference between these scopes. Ledger 3.0 contains provisions for GUIs, which would make use of the different scopes by keeping an @@ -5681,7 +5978,7 @@ desired width. @item --account @var{STR} Prepend @var{STR} to all accounts reported. That is, the option -@samp{--account Personal} would track @samp{Personal:} to the beginning +@samp{--account Personal} would tack @samp{Personal:} to the beginning of every account reported in a balance report or register report. @item --account-width @var{INT} @@ -5690,11 +5987,11 @@ to @var{INT} characters. @item --actual @itemx -L -Report only real transactions, with no automated or virtual -transactions used. +Report only real transactions, ignoring all automated or virtual +transactions. @item --add-budget -Show only un-budgeted postings. +Show only unbudgeted postings. @item --amount @var{EXPR} @itemx -t @var{EXPR} @@ -5704,7 +6001,7 @@ arbitrary transformation to the postings. @item --amount-data @itemx -j -On a register report print only the dates and amount of postings. +On a register report print only the date and amount of postings. Useful for graphing and spreadsheet applications. @item --amount-width @var{INT} @@ -5754,17 +6051,17 @@ that date will be ignored. Print the entire line in bold if the given value expression is true (@pxref{Value Expressions}). -@smallexample -$ ledger reg Expenses --begin Dec --bold-if "amount > 100" +@smallexample @c command:validate +$ ledger reg Expenses --begin Dec --bold-if "amount>100" @end smallexample @noindent -list all transactions since the beginning of December and bold any -posting greater than $100. +list all transactions since the beginning of December and print in +bold any posting greater than $100. @item --budget Only display budgeted items. In a register report this -displays transaction in the budget, in a balance report this displays +displays transactions in the budget, in a balance report this displays accounts in the budget (@pxref{Budgeting and Forecasting}). @item --budget-format @var{FORMAT_STRING} @@ -5785,7 +6082,7 @@ Group the register report by payee. @item --cleared @itemx -C -Consider only transaction that have been cleared for display and +Consider only transactions that have been cleared for display and calculation. @item --cleared-format @var{FORMAT_STRING} @@ -5807,22 +6104,22 @@ Strings}). The default is: @item --collapse @itemx -n -By default ledger prints all account in an account tree. With -@option{--collapse} it print only the top level account specified. +By default ledger prints all accounts in an account tree. With +@option{--collapse} it prints only the top level account specified. @item --collapse-if-zero Collapse the account display only if it has a zero balance. @item --color @itemx --ansi -Use color is the tty supports it. +Use color if the terminal supports it. @item --columns @var{INT} Specify the width of the @command{register} report in characters. @item --count Direct ledger to report the number of items when appended to the -commodities, accounts or payees command. +@command{commodities}, @command{accounts} or @command{payees} command. @item --csv-format @var{FORMAT_STRING} Specify the format to use for the @command{csv} report (@pxref{Format @@ -5833,7 +6130,7 @@ Strings}). The default is: "%(quoted(code))," "%(quoted(payee))," "%(quoted(display_account))," -"%(quoted(commodity))," +"%(quoted(commodity(scrub(display_amount))))," "%(quoted(quantity(scrub(display_amount))))," "%(quoted(cleared ? \"*\" : (pending ? \"!\" : \"\")))," "%(quoted(join(note | xact.note)))\n" @@ -5851,8 +6148,8 @@ Transform the date of the transaction using @var{EXPR}. @item --date-format @var{DATE_FORMAT} @itemx -y @var{DATE_FORMAT} -Specify format ledger should use to print dates (@pxref{Date and Time -Format Codes}). +Specify the format ledger should use to read and print dates +(@pxref{Date and Time Format Codes}). @item --date-width @var{INT} Specify the width, in characters, of the date column in the @@ -5863,8 +6160,9 @@ FIX THIS ENTRY @c ASK JOHN @item --dc Display register or balance in debit/credit format If you use -@option{--dc} with either the register (reg) or balance (bal) commands, -you will now get extra columns. The register goes from this: +@option{--dc} with either the @command{register} (reg) or +@command{balance} (bal) commands, you will now get extra columns. +The register goes from this: @smallexample 12-Mar-10 Employer Assets:Cash $100 $100 @@ -5921,9 +6219,9 @@ And with @option{--dc} it becomes this: @item --depth @var{INT} Limit the depth of the account tree. In a balance report, for example, -a @samp{--depth 2} statement will print balances only for account with +a @samp{--depth 2} statement will print balances only for accounts with two levels, i.e. @samp{Expenses:Entertainment} but not -@samp{Expenses:entertainemnt:Dining}. This is a display predicate, which +@samp{Expenses:Entertainment:Dining}. This is a display predicate, which means it only affects display, not the total calculations. @item --deviation @@ -5931,21 +6229,21 @@ Report each posting’s deviation from the average. It is only meaningful in the register and prices reports. @item --display @var{EXPR} -Display lines that satisfy the expression given. +Display only lines that satisfy the expression @var{EXPR}. @item --display-amount @var{EXPR} -Apply a transform to the @emph{displayed} amount. This occurs after -calculations occur. +Apply a transformation to the @emph{displayed} amount. This happens +after calculations occur. @item --display-total @var{EXPR} -Apply a transform to the @emph{displayed} total. This occurs after +Apply a transformation to the @emph{displayed} total. This happens after calculations occur. @item --dow @itemx --days-of-week -Group transactions by the days of the week. +Group transactions by the day of the week. -@smallexample +@smallexample @c command:validate $ ledger reg Expenses --dow --collapse @end smallexample @@ -5954,11 +6252,11 @@ Will print all Expenses totaled for each day of the week. @item --empty @itemx -E -Include empty accounts in the report. +Include empty accounts in the report and in average calculations. @item --end @var{DATE} -Specify the end @var{DATE} for transaction to be considered in the -report. +Specify the end @var{DATE} for a transaction to be considered in the +report. All transactions on or after this date are ignored. @item --equity Related to the @command{equity} command (@pxref{The @command{equity} @@ -5971,15 +6269,24 @@ FIX THIS ENTRY @c ASK JOHN @item --exchange @var{COMMODITY} @itemx -X @var{COMMODITY} Display values in terms of the given @var{COMMODITY}. The latest -available price is used. +available price is used. The syntax +@option{-X @var{COMMODITY1}:@var{COMMODITY2}} displays values in @var{COMMODITY1} +in terms of @var{COMMODITY2} using the latest available price, but +will not automatically covert any other commodities to +@var{COMMODITY2}. Multiple @option{-X} arguments may be used on a +single command line (as in +@option{-X COMMODITY1:COMMODITY2 -X COMMODITY3:COMMODITY2}), +which is particularly useful for situations where many prices are +available for reporting in terms of @var{COMMODITY2}, but only a few +should be displayed that way. @item --flat Force the full names of accounts to be used in the balance report. The balance report will not use an indented tree. @item --force-color -Output tty color codes even if the tty doesn't support them. Useful -for TTY that don't advertise their capabilities correctly. +Output TTY color codes even if the TTY doesn't support them. Useful +for TTYs that don't advertise their capabilities correctly. @item --force-pager Force Ledger to paginate its output. @@ -5989,7 +6296,7 @@ Force Ledger to paginate its output. Continue forecasting while @var{VEXPR} is true. @item --forecast-years @var{INT} -Forecast at most @var{INT} years in the future. +Forecast at most @var{INT} years into the future. @item --format @var{FORMAT_STRING} @itemx -F @var{FORMAT_STRING} @@ -6006,14 +6313,14 @@ transactions) in the report, in cases where you normally wouldn't want them. @item --group-by @var{EXPR} -Group transaction together in the @command{register} report. +Group transactions together in the @command{register} report. @var{EXPR} can be anything, although most common would be @code{payee} or @code{commodity}. The @code{tags()} function is also useful here. @item --group-title-format @var{FORMAT_STRING} -Set the format for the headers that separate reports section of -a grouped report. Only has effect with a @option{--group-by @var{EXPR}} -register report. +Set the format for the headers that separates the report sections of +a grouped report. Only has an effect with a @option{--group-by +@var{EXPR}} register report. @smallexample $ ledger reg Expenses --group-by "payee" --group-title-format "------------------------ %-20(value) ---------------------\n" @@ -6041,11 +6348,11 @@ FIX THIS ENTRY @c FIXME thdox FIX THIS ENTRY @c FIXME thdox @item --inject -Use @code{Expected} amounts in calculations. In the case that you know -that amount a transaction should be, but the actual transaction has the -wrong value you can use metadata to put in the expected amount: +Use @code{Expected} amounts in calculations. In case you know +what amount a transaction should be, but the actual transaction has the +wrong value you can use metadata to specify the expected amount: -@smallexample +@smallexample @c input:validate 2012-03-12 Paycheck Income $-990; Expected:: $-1000.00 Checking @@ -6059,8 +6366,8 @@ Change the sign of all reported values. @item --limit @var{EXPR} @itemx -l @var{EXPR} -Only transactions that satisfy the expression will be considered in the -calculation. +Only transactions that satisfy @var{EXPR} are considered in +calculations and for display. @item --lot-dates Report the date on which each commodity in a balance report was @@ -6097,12 +6404,15 @@ Specify the width of the Meta column used for the @option{--meta @itemx -M Synonym for @samp{--period "monthly"}. +@item --no-aliases +Aliases are completely ignored. + @item --no-color Suppress any color TTY output. @item --no-rounding Don't output @samp{<Rounding>} postings. Note that this will cause the -running total to often not add up! It's main use is for +running total to often not add up! Its main use is for @option{--amount-data (-j)} and @option{--total-data (-J)} reports. @item --no-titles @@ -6112,7 +6422,7 @@ Suppress the output of group titles. Suppress printing the final total line in a balance report. @item --now @var{DATE} -Define the current date in case to you to do calculate in the past or +Define the current date in case you want to calculate in the past or future using @option{--current}. @item --only @var{FIXME} @@ -6132,22 +6442,22 @@ a date and payee for each transaction. @item --payee-width @var{INT} Set the number of columns dedicated to the payee in the register -report. +report to @var{INT}. @item --pending Use only postings that are marked pending. @item --percent @itemx -% -Calculate the percentage value of each account in a balance reports. -Only works for account that have a single commodity. +Calculate the percentage value of each account in balance reports. +Only works for accounts that have a single commodity. @item --period @var{PERIOD_EXPRESSION} Define a period expression that sets the time period during which transactions are to be accounted. For a @command{register} report only the transactions that satisfy the period expression with be displayed. -For a balance report only those transactions will be accounted in the -final balances. +For a @command{balance} report only those transactions will be accounted +in the final balances. @item --pivot @var{TAG} Produce a balance pivot report @emph{around} the given @var{TAG}. For @@ -6157,7 +6467,7 @@ identifying which car the purchase was for @samp{; Car: Prius}, then the command: @smallexample -$ ledger bal Fuel --pivot "Car" --period "this year" +$ ledger bal Fuel --pivot "Car" --period "this year" $ 3491.26 Car $ 1084.22 M3:Expenses:Auto:Fuel $ 149.65 MG V11:Expenses:Auto:Fuel @@ -6200,16 +6510,16 @@ Show primary dates for all calculations (@pxref{Effective Dates}). @item --quantity @itemx -O -FIX THIS ENTRY +Report commodity totals (this is the default). @item --quarterly Synonym for @samp{--period "quarterly"}. @item --raw -In the print report, show transactions using the exact same syntax as -specified by the user in their data file. Don't do any massaging or -interpreting. Can be useful for minor cleanups, like just aligning -amounts. +In the @command{print} report, show transactions using the exact same +syntax as specified by the user in their data file. Don't do any +massaging or interpreting. This can be useful for minor cleanups, like +just aligning amounts. @item --real @itemx -R @@ -6217,11 +6527,11 @@ Account using only real transactions ignoring virtual and automatic transactions. @item --register-format @var{FORMAT_STRING} -FIX THIS ENTRY @c FIXME thdox +Define the output format for the @command{register} report. @item --related -In a register report show the related account. This is the other -@emph{side} of the transaction. +In a @command{register} report show the related account. This is the +other @emph{side} of the transaction. @item --related-all Show all postings in a transaction, similar to @option{--related} but @@ -6241,19 +6551,20 @@ FIX THIS ENTRY FIX THIS ENTRY @c FIXME thdox @item --seed @var{FIXME} -Set the random seed for the @code{generate} command. Used as part of -development testing. +Set the random seed to @var{FIXME} for the @code{generate} command. +Used as part of development testing. @item --sort @var{VEXPR} @itemx -S @var{VEXPR} -Sort the register report based on the value expression given to sort. +Sort the @command{register} report based on the value expression given +to sort. @item --sort-all @var{FIXME} FIX THIS ENTRY @item --sort-xacts @var{VEXPR} @itemx --period-sort @var{VEXPR} -Sort the posting within transactions using the given value expression. +Sort the postings within transactions using the given value expression. @item --start-of-week @var{INT} Tell ledger to use a particular day of the week to start its ``weekly'' @@ -6266,8 +6577,8 @@ FIX THIS ENTRY @item --tail @var{INT} @itemx --last @var{INT} -Report only the last @var{INT} entries. Only useful on a register -report. +Report only the last @var{INT} entries. Only useful in +a @command{register} report. @item --time-report FIX THIS ENTRY @c FIXME thdox @@ -6278,7 +6589,7 @@ Define a value expression used to calculate the total in reports. @item --total-data @itemx -J -FIX THIS ENTRY +Show only dates and totals to format the output for plots. @item --total-width @var{INT} Set the width of the total field in the register report. @@ -6291,39 +6602,41 @@ as it considers sub-names within the account name (that style is called ``abbreviate''). @item --unbudgeted -FIX THIS ENTRY +Show only unbudgeted postings. @item --uncleared @itemx -U Use only uncleared transactions in calculations and reports. @item --unrealized -FIX THIS ENTRY +Show generated unrealized gain and loss accounts in the balance +report. @item --unrealized-gains @var{STR} Allow the user to specify what account name should be used for unrealized gains. Defaults to @samp{"Equity:Unrealized Gains"}. -Often set in one's @file{~/.ledgerrc} file to change default. +Often set in one's @file{~/.ledgerrc} file to change the default. @item --unrealized-losses @var{STR} Allow the user to specify what account name should be used for unrealized gains. Defaults to @samp{"Equity:Unrealized Losses"}. -Often set in one's @file{~/.ledgerrc} file to change default. +Often set in one's @file{~/.ledgerrc} file to change the default. @item --unround Perform all calculations without rounding and display results to full precision. @item --values -FIX THIS ENTRY @c FIXME thdox +Shows the values used by each tag when used in combination with the +@command{tags} command. @item --weekly @itemx -W Synonym for @samp{--period "weekly"}. @item --wide -Let the register report use 132 columns. Identical to @samp{--columns -"132"}. +Let the register report use 132 columns instead of 80 (the default). +Identical to @samp{--columns "132"}. @item --yearly @itemx -Y @@ -6343,19 +6656,17 @@ variables}), instead of using actual command-line options: @item --help @itemx -h Print a summary of all the options, and what they are used for. This -can be a handy way to remember which options do what. This help screen -is also printed if ledger is run without a command. +can be a handy way to remember which options do what. @item --version -@itemx -v Print the current version of ledger and exits. This is useful for sending bug reports, to let the author know which version of ledger you are using. @item --file @var{FILE} @itemx -f @var{FILE} -Read @file{FILE} as a ledger file. @var{FILE} can be @samp{-} that is -a synonym of @samp{/dev/stdin}. This command may be used multiple +Read @file{FILE} as a ledger file. @var{FILE} can be @samp{-} which is +a synonym for @samp{/dev/stdin}. This command may be used multiple times. Typically, the environment variable @env{LEDGER_FILE} is set, rather than using this command-line option. @@ -6369,12 +6680,12 @@ goes to standard output. Causes @file{FILE} to be read by ledger before any other ledger file. This file may not contain any postings, but it may contain option settings. To specify options in the init file, use the same syntax as -the command-line, but put each option on its own line. Here is an +on the command-line, but put each option on its own line. Here is an example init file: @smallexample --price-db ~/finance/.pricedb - +--wide ; ~/.ledgerrc ends here @end smallexample @@ -6411,7 +6722,7 @@ first matching transaction. (Note: This is different from using @item --end @var{DATE} @itemx -e @var{DATE} Constrain the report so that transactions on or after @var{DATE} are -not considered. The ending date is inclusive. +not considered. @item --period @var{PERIOD_EXPRESSION} @itemx -p @var{PERIOD_EXPRESSION} @@ -6419,8 +6730,8 @@ Set the reporting period to @var{STR}. This will subtotal all matching transactions within each period separately, making it easy to see weekly, monthly, quarterly, etc., posting totals. A period string can even specify the beginning and end of the report range, using simple -terms like @samp{last June} or @samp{next month}. For more using period -expressions, see @ref{Period Expressions}. +terms like @samp{last June} or @samp{next month}. For more details on +period expressions, see @ref{Period Expressions}. @item --period-sort @var{VEXPR} Sort the postings within each reporting period using the value @@ -6428,8 +6739,9 @@ expression @var{EXPR}. This is most often useful when reporting monthly expenses, in order to view the highest expense categories at the top of each month: -@smallexample -$ ledger -M --period-sort -At reg ^Expenses +@c TODO: the parameter to --period-sort was -At, which doesn't seem to work any longer +@smallexample @c command:validate +$ ledger -M --period-sort total reg ^Expenses @end smallexample @item --cleared @@ -6450,8 +6762,8 @@ see @ref{Virtual postings} for more information). @item --actual @itemx -L -Display only actual postings, and not those created due to automated -postings. +Display only actual postings, and not those created by automated +transactions. @item --related @itemx -r @@ -6462,7 +6774,7 @@ In the balance report, it shows all the accounts affected by transactions having a related posting. For example, if a file had this transaction: -@smallexample +@smallexample @c input:94C5675 2004/03/20 Safeway Expenses:Food $65.00 Expenses:Cash $20.00 @@ -6471,21 +6783,21 @@ this transaction: And the register command was: -@smallexample -$ ledger -r register food +@smallexample @c command:94C5675 +$ ledger -f example.dat -r register food @end smallexample -The following would be output, showing the postings related to the +The following would be printed, showing the postings related to the posting that matched: -@smallexample -2004/03/20 Safeway Expenses:Cash $-20.00 $-20.00 - Assets:Checking $85.00 $65.00 +@smallexample @c output:94C5675 +04-Mar-20 Safeway Expenses:Cash $20.00 $20.00 + Assets:Checking $-85.00 $-65.00 @end smallexample @item --budget Useful for displaying how close your postings meet your budget. -@option{--add-budget} also shows un-budgeted postings, while +@option{--add-budget} also shows unbudgeted postings, while @option{--unbudgeted} shows only those. @option{--forecast @var{VEXPR}} is a related option that projects your budget into the future, showing how it will affect future balances. @xref{Budgeting and Forecasting}. @@ -6552,7 +6864,7 @@ Set the value expression used for the ``totals'' column in the @c ledger reg food not dining expr 'payee =~ /chang/' @c @end smallexample -@node Output customization, Commodity reporting, Report filtering, Detailed Option Description +@node Output customization, Commodity reporting, Report filtering, Detailed Option Description @subsection Output customization These options affect only the output, but not which postings are @@ -6590,23 +6902,24 @@ Report posting totals by month. @item --yearly @itemx -Y -Report posting totals by year. For more complex period, using the +Report posting totals by year. For more complex periods, use +@option{--period}. @c TODO end this sentence @item --period @var{PERIOD_EXPRESSION} Option described above. @item --dow -Report postings totals for each day of the week. This is an easy way +Report posting totals for each day of the week. This is an easy way to see if weekend spending is more than on weekdays. @item --sort @var{VEXPR} @itemx -S @var{VEXPR} Sort a report by comparing the values determined using the value -expression @var{VEXPR}. For example, using @samp{-S -UT} in the balance -report will sort account balances from greatest to least, using the -absolute value of the total. For more on how to use value expressions, -see @ref{Value Expressions}. +expression @var{VEXPR}. For example, using @samp{-S "-abs(total)"} in +the @command{balance} report will sort account balances from greatest to +least, using the absolute value of the total. For more on how to use +value expressions, see @ref{Value Expressions}. @item --pivot @var{TAG} Produce a pivot table around the @var{TAG} provided. This requires @@ -6650,7 +6963,7 @@ the parent account. @item --amount-data @itemx -j -Change the @command{register} report so that it outputs nothing but the +Change the @command{register} report so that it prints nothing but the date and the value column, and the latter without commodities. This is only meaningful if the report uses a single commodity. This data can then be fed to other programs, which could plot the date, analyze it, @@ -6658,17 +6971,18 @@ etc. @item --total-data @itemx -J -Change the @command{register} report so that it outputs nothing but the -date and totals column, without commodities. +Change the @command{register} report so that it prints nothing but the +date and total columns, without commodities. @item --display @var{EXPR} @itemx -d @var{EXPR} -Limit which postings or accounts or actually displayed in a report. +Limit which postings or accounts are actually displayed in a report. They might still be calculated, and be part of the running total of a register report, for example, but they will not be displayed. This is useful for seeing last month's checking postings, against a running balance which includes all posting values: +@c TODO: does not @c command:validate due to space in "last month" @smallexample $ ledger -d "d>=[last month]" reg checking @end smallexample @@ -6677,6 +6991,7 @@ The output from this command is very different from the following, whose running total includes only postings from the last month onward: +@c TODO: does not @c command:validate due to space in "last month" @smallexample $ ledger -p "last month" reg checking @end smallexample @@ -6780,7 +7095,7 @@ Set the format for @command{csv} reports. The default is: %(quoted(code)), %(quoted(payee)), %(quoted(display_account)), - %(quoted(commodity)), + %(quoted(commodity(scrub(display_amount)))), %(quoted(quantity(scrub(display_amount)))), %(quoted(cleared ? \"*\" : (pending ? \"!\" : \"\"))), %(quoted(join(note | xact.note)))\n" @@ -6871,7 +7186,7 @@ There are several different ways that ledger can report the totals it displays. The most flexible way to adjust them is by using value expressions, and the @option{--amount @var{EXPR} (-t)} and @option{--total @var{VEXPR} (-T)} options. However, there are also -several ``default'' reports, which will satisfy most users basic +several ``default'' reports, which will satisfy most users' basic reporting needs: @ftable @code @@ -6918,7 +7233,7 @@ If no @var{VALUE} property is specified, each posting is assumed to have a default, as if you'd specified a global, automated transaction as follows: -@smallexample +@smallexample @c input:validate = expr true ; VALUE:: market(amount, date, exchange) @end smallexample @@ -6932,7 +7247,7 @@ This definition emulates the present day behavior of @option{--market One thing many people have wanted to do is to fixate the valuation of old European currencies in terms of the Euro after a certain date: -@smallexample +@smallexample @c input:validate = expr commodity == "DM" ; VALUE:: date < [Jun 2008] ? market(amount, date, exchange) : 1.44 EUR @end smallexample @@ -6944,7 +7259,7 @@ past June 2008, use a fixed price for converting Deutsch Mark to Euro. Or how about never re-valuating commodities used in Expenses, since they cannot have a different future value: -@smallexample +@smallexample @c input:validate = /^Expenses:/ ; VALUE:: market(amount, post.date, exchange) @end smallexample @@ -6956,7 +7271,7 @@ the value of @option{--now @var{DATE}} (defaults to today). Or how about valuating miles based on a reimbursement rate during a specific time period: -@smallexample +@smallexample @c input:validate = expr commodity == "miles" and date >= [2007] and date < [2008] ; VALUE:: market($1.05, date, exchange) @end smallexample @@ -6970,7 +7285,7 @@ Note that you can have a valuation expression specific to a particular posting or transaction, by overriding these general defaults using specific meta-data: -@smallexample +@smallexample @c input:validate 2010-12-26 Example Expenses:Food $20 ; Just to be silly, always valuate *these* $20 as 30 DM, no matter what @@ -6979,7 +7294,7 @@ specific meta-data: Assets:Cash @end smallexample -This example demonstrates that your VALUE expression should be as +This example demonstrates that your value expression should be as symbolic as possible, using terms like 'amount' and 'date', rather than specific amounts and dates. Also, you should pass the amount along to the function 'market' so it can be further revalued if the user has @@ -6990,7 +7305,9 @@ which allows you to report most everything in EUR if you use @samp{-X EUR}, except for certain accounts or postings which should always be valuated in another currency. For example: -@smallexample +@c TODO is this example missing the actual line to get the effect? +@c it looks like it only contains a match, but no effect +@smallexample @c input:validate = /^Assets:Brokerage:CAD$/ ; Always report the value of commodities in this account in ; terms of present day dollars, despite what was asked for @@ -7026,13 +7343,14 @@ these values: @itemize @item Register Report -For the register report, use the value of that commodity on the date of -the posting being reported, with a @samp{<Revalued>} posting added at -the end of today's value is different from the value of the last -posting. +For the @command{register} report, use the value of that commodity on +the date of the posting being reported, with a @samp{<Revalued>} posting +added at the end if today's value is different from the value of the +last posting. @item Balance Report -For the balance report, use the value of that commodity as of today. +For the @command{balance} report, use the value of that commodity as of +today. @end itemize @@ -7045,6 +7363,17 @@ You can also now use @option{--exchange @var{COMMODITY} (-X)} (and and @option{--price (-I)}, to see valuation reports of just your basis costs or lot prices. +Finally, sometimes, you may seek to only report one (or some subset) of +the commodities in terms of another commodity. In this situation, you +can use the syntax @option{--exchange @var{COMMODITY1}:@var{COMMODITY2}} +to request that ledger always display @var{COMMODITY1} in terms of +@var{COMMODITY2}, but you want no other commodities to be automatically +displayed in terms of @var{COMMODITY2} without additional +@option{--exchange} options. For example, if you wanted to report EUR +and BTC in terms of USD, but report all other commodities without +conversion to USD, you could use: @option{--exchange EUR:USD --exchange +BTC:USD}. + @node Environment variables, , Commodity reporting, Detailed Option Description @subsection Environment variables @@ -7171,11 +7500,11 @@ your expectations. To start keeping a budget, put some periodic transactions (@pxref{Periodic Transactions}) at the top of your ledger file. A -period transaction is almost identical to a regular transaction, except +periodic transaction is almost identical to a regular transaction, except that it begins with a tilde and has a period expression in place of a payee. For example: -@smallexample +@smallexample @c input:validate ~ Monthly Expenses:Rent $500.00 Expenses:Food $450.00 @@ -7192,9 +7521,9 @@ payee. For example: Assets @end smallexample -These two period transactions give the usual monthly expenses, as well +These two periodic transactions give the usual monthly expenses, as well as one typical yearly expense. For help on finding out what your -average monthly expense is for any category, use a command like: +average monthly expenses are for any category, use a command like: @smallexample $ ledger -p "this year" --monthly --average balance ^expenses @@ -7202,26 +7531,26 @@ $ ledger -p "this year" --monthly --average balance ^expenses The reported totals are the current year's average for each account. -Once these period transactions are defined, creating a budget report is +Once these periodic transactions are defined, creating a budget report is as easy as adding @option{--budget} to the command-line. For example, a typical monthly expense report would be: -@smallexample +@smallexample @c command:validate $ ledger --monthly register ^expenses @end smallexample To see the same report balanced against your budget, use: -@smallexample +@smallexample @c command:validate $ ledger --budget --monthly register ^expenses @end smallexample A budget report includes only those accounts that appear in the budget. To see all expenses balanced against the budget, use -@option{--add-budget}. You can even see only the un-budgeted expenses +@option{--add-budget}. You can even see only the unbudgeted expenses using @option{--unbudgeted}: -@smallexample +@smallexample @c command:validate $ ledger --unbudgeted --monthly register ^expenses @end smallexample @@ -7233,21 +7562,21 @@ You can also use these flags with the @command{balance} command. Sometimes it's useful to know what your finances will look like in the future, such as determining when an account will reach zero. Ledger -makes this easy to do, using the same period transactions as are used +makes this easy to do, using the same periodic transactions as are used for budgeting. An example forecast report can be generated with: -@smallexample +@smallexample @c command:validate $ ledger --forecast "T>@{\$-500.00@}" register ^assets ^liabilities @end smallexample This report continues outputting postings until the running total -is greater than $-500.00. A final posting is always output, to -show you what the total afterwards would be. +is greater than $-500.00. A final posting is always shown, to +inform you what the total afterwards would be. -Forecasting can also be used with the balance report, but by date -only, and not against the running total: +Forecasting can also be used with the @command{balance} report, +but by date only, and not against the running total: -@smallexample +@smallexample @c command:validate $ ledger --forecast "d<[2010]" bal ^assets ^liabilities @end smallexample @@ -7257,7 +7586,7 @@ $ ledger --forecast "d<[2010]" bal ^assets ^liabilities Ledger directly supports ``timelog'' entries, which have this form: -@smallexample +@smallexample @c input:validate i 2013/03/28 22:13:00 ACCOUNT[ PAYEE] o 2013/03/29 03:39:00 @end smallexample @@ -7265,21 +7594,21 @@ o 2013/03/29 03:39:00 This records a check-in to the given ACCOUNT, and a check-out. You can be checked-in to multiple accounts at a time, if you wish, and they can span multiple days (use @option{--day-break} to break them up in the -report). The number of seconds between is accumulated as time to that -ACCOUNT. If the checkout uses a capital @samp{O}, the transaction is -marked ``cleared''. You can use an optional PAYEE for whatever meaning -you like. +report). The number of seconds between check-in and check-out is +accumulated as time to that ACCOUNT. If the checkout uses a capital +@samp{O}, the transaction is marked ``cleared''. You can use an +optional PAYEE for whatever meaning you like. Now, there are a few ways to generate this information. You can use the @file{timeclock.el} package, which is part of Emacs. Or you can write a simple script in whichever language you prefer to emit similar information. Or you can use Org mode's time-clocking abilities and -the org2tc script developed by John Wiegley. +the @file{org2tc} script developed by John Wiegley. These timelog entries can appear in a separate file, or directly in -your main ledger file. The initial @samp{i} and @samp{o} count as -Ledger ``directives'', and are accepted anywhere that ordinary -transactions are. +your main ledger file. The initial @samp{i} and @samp{o} characters +count as Ledger ``directives'', and are accepted anywhere that +ordinary transactions are valid. @node Value Expressions, Format Strings, Time Keeping, Top @chapter Value Expressions @@ -7314,7 +7643,7 @@ addition to a set of functions and variables. @c a display predicate that I use with the @command{balance} command: @c @smallexample -@c ledger -d /^Liabilities/?T<0:UT>100 balance +@c ledger -d '/^Liabilities/?T<0:UT>100' balance @c @end smallexample @c The effect is that account totals are displayed only if: 1) A @@ -7332,7 +7661,7 @@ while still calculating the running balance based on all transactions: $ ledger -d "d>[this month]" register checking @end smallexample -This advantage to this command's complexity is that it prints the +The advantage of this command's complexity is that it prints the running total in terms of all transactions in the register. The following, simpler command is similar, but totals only the displayed postings: @@ -7354,9 +7683,9 @@ $ ledger -b "this month" register checking @findex --total @var{VEXPR} Below are the one letter variables available in any value expression. -For the register and print commands, these variables relate to -individual postings, and sometimes the account affected by a -posting. For the balance command, these variables relate to +For the @command{register} and @command{print} commands, these variables +relate to individual postings, and sometimes the account affected by a +posting. For the @command{balance} command, these variables relate to accounts, often with a subtle difference in meaning. The use of each variable for both is specified. @@ -7364,10 +7693,11 @@ variable for both is specified. @item t This maps to whatever the user specified with @option{--amount -@var{EXPR} (-t)}. In a register report, @option{--amount @var{EXPR} -(-t)} changes the value column; in a balance report, it has no meaning -by default. If @option{--amount @var{EXPR} (-t)} was not specified, the -current report style's value expression is used. +@var{EXPR} (-t)}. In a @command{register} report, @option{--amount +@var{EXPR} (-t)} changes the value column; in a @command{balance} +report, it has no meaning by default. If @option{--amount @var{EXPR} +(-t)} was not specified, the current report style's value expression is +used. @item T This maps to whatever the user specified with @option{--total @@ -7404,15 +7734,15 @@ The cost of a posting; the cost of an account, without its children. @item v -The market value of a posting, or an account without its children. +The market value of a posting or an account, without its children. @item g The net gain (market value minus cost basis), for a posting or an -account without its children. It is the same as @samp{v-b}. +account, without its children. It is the same as @samp{v-b}. @item depth The depth (``level'') of an account. If an account has one parent, -it's depth is one. +its depth is one. @item n The index of a posting, or the count of postings affecting an @@ -7538,48 +7868,99 @@ More complicated expressions are possible using: @table @code -@item NUM -A plain integer represents a commodity-less amount. - -@item @{AMOUNT@} -An amount in braces can be any kind of amount supported by ledger, +@item "amount == COMMODITY AMOUNT" +The amount can be any kind of amount supported by ledger, with or without a commodity. Use this for decimal values. @item /REGEX/ -@itemx W/REGEX/ +@itemx account =~ /REGEX/ A regular expression that matches against an account's full name. If a posting, this will match against the account affected by the posting. -@item //REGEX/ -@itemx p/REGEX/ +@item @@/REGEX/ +@itemx expr payee =~ /REGEX/ A regular expression that matches against a transaction's payee name. -@item ///REGEX/ -@itemx w/REGEX/ -A regular expression that matches against an account's base name. If -a posting, this will match against the account affected by the -posting. +@item %/REGEX/ +@itemx tag(REGEX) +A regular expression that matches against a transaction's tags. + +@item expr date =~ /REGEX/ +Useful for specifying a date in plain terms. For example, you could say +@samp{expr date =~ /2014/}. + +@item expr comment =~ /REGEX/ +A regular expression that matches against a posting's comment +field. This searches only a posting's field, not the transaction's note +or comment field. For example, @code{ledger reg "expr" "comment =~ +/landline/"} will match: + +@smallexample +2014/1/29 Phone bill + Assets:Checking $50.00 + Expenses:Phone $-50.00 ; landline bill +@end smallexample + +but will not match: + +@smallexample +2014/1/29 Phone bill ; landline bill + ; landline bill + Assets:Checking $50.00 + Expenses:Phone $-50.00 +@end smallexample + +To match the latter, use @samp{ledger reg "expr" "note =~ /landline/"} +instead. + +@item expr note =~ /REGEX/ +A regular expression that matches against a transaction's note field. +This searches all comments in the transaction, including comments on +individual postings. Thus, @samp{ledger reg "expr" "note =~ /landline/"} +will match both all the three examples below: + +@smallexample +2014/1/29 Phone bill + Assets:Checking $50.00 + Expenses:Phone $-50.00 ; landline bill +@end smallexample + +@smallexample +2014/1/29 Phone bill ; landline bill + Assets:Checking $50.00 + Expenses:Phone $-50.00 +@end smallexample + +@smallexample +2014/1/29 Phone bill + ; landline bill + Assets:Checking $50.00 + Expenses:Phone $-50.00 +@end smallexample -@item c/REGEX/ -A regular expression that matches against the transaction code (the -text that occurs between parentheses before the payee name). -@item e/REGEX/ -A regular expression that matches against a posting's note, or -comment field. @item (EXPR) A sub-expression is nested in parenthesis. This can be useful passing more complicated arguments to functions, or for overriding the natural precedence order of operators. -@item [DATE] -Useful specifying a date in plain terms. For example, you could say -@samp{[2004/06/01]}. +@item expr base =~ /REGEX/ +A regular expression that matches against an account's base name. If +a posting, this will match against the account affected by the +posting. + +@item expr code =~ /REGEX/ +A regular expression that matches against the transaction code (the +text that occurs between parentheses before the payee). @end table +The @command{query} command can be used to see how Ledger interprets +your query. This can be useful if you are not getting the results you +expect (@pxref{Pre-Commands}). + @menu * Miscellaneous:: @end menu @@ -7758,8 +8139,8 @@ format string, exactly like those supported by @code{strftime}. For example: @samp{%[%Y/%m/%d %H:%M:%S]}. @item S -Insert the pathname of the file from which the transaction's data was -read. Only sensible in a register report. +Insert the path name of the file from which the transaction's data was +read. Only sensible in a @command{register} report. @item B Inserts the beginning character position of that transaction within the @@ -7775,14 +8156,12 @@ file. @item e Inserts the ending line of that transaction within the file. -@c @item D By default, this is the same as @code{%[%Y/%m%/d]}. The date -@c format used can be changed at any time with the @option{--date-format -@c @var{DATE_FORMAT} (-y)} flag, however. Using @code{%D} gives the -@c user more control over the way dates are output. +@item D +Returns the date according to the default format. @item d Returns the date according to the default format. If the transaction -has an effective date, it prints @code{[ACTUAL_DATE=EFFECTIVE_DATE]}. +has an effective date, it prints @code{ACTUAL_DATE=EFFECTIVE_DATE}. @item X If a posting has been cleared, this returns a 1, otherwise returns 0. @@ -7792,8 +8171,8 @@ This is the same as @samp{%X}, except that it only displays a state character if all of the member postings have the same state. @item C -Inserts the transaction type. This is the value specified between -parenthesis on the first line of the transaction. +Inserts the transaction code. This is the value specified between +parentheses on the first line of the transaction. @item P Inserts the payee related to a posting. @@ -7879,7 +8258,7 @@ options: @node Colors, Quantities and Calculations, Field Widths, Formatting Functions and Codes @subsection Colors -The character based formatting ledger can do is limited to the ANSI +The character-based formatting ledger can do is limited to the ANSI terminal character colors and font highlights in a normal TTY session. @multitable @columnfractions .3 .3 .3 @@ -8020,10 +8399,10 @@ weekday, abbreviated Wed. weekday, full Wednesday. @item %d -day of the month (dd), zero padded 10. +day of the month (dd), zero padded up to 10. @item %e -day of the month (dd) 10. +day of the month (dd), no leading zero up to 10. @item %j day of year, zero padded 000–366. @@ -8065,7 +8444,7 @@ Locale’s abbreviated month, for example @samp{02} might be abbreviated as @samp{Feb}. @item %B -Locale’s full month, variable length February. +Locale’s full month, variable length, e.g. February. @end table @@ -8118,7 +8497,7 @@ subsequent lines the width is given by @code{latterwidth}. If If @code{right_justify=true} then the field is right justify within the width of the field. If it is @code{false}, then the field is left justified and padded to the full width of the field. If -@code{colorize} is true then ledger will honor color settings. +@code{colorize} is true, then ledger will honor color settings. @item join(STR) Replaces line feeds in @code{STR} with @samp{\n}. @@ -8142,7 +8521,8 @@ generated the posting. @table @code @item filename -name of ledger data file from whence posting came, abbreviated @samp{S}. +the name of ledger the data file from whence the posting came, +abbreviated @samp{S}. @item beg_pos character position in @code{filename} where entry for posting begins, @@ -8171,47 +8551,47 @@ 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. Even if you don't create a session manually, one is created for you by the top-level interface functions. The Session is where objects live -like the Commodity's that Amount's refer to. +like the Commodities that Amounts refer to. The make a Session useful, you must read a Journal into it, using the function `@code{read_journal}`. This reads Ledger data from the given file, populates a Journal object within the current Session, and returns a reference to that Journal object. -Within the Journal live all the Transaction's, Posting's, and other -objects related to your data. There are also AutomatedTransaction's -and PeriodicTransaction's, etc. +Within the Journal live all the Transactions, Postings, and other +objects related to your data. There are also AutomatedTransactions +and PeriodicTransactions, etc. Here is how you would traverse all the postings in your data file: @smallexample import ledger -for xact in ledger.read_journal("sample.dat").xacts: - for post in xact.posts: +for xact in ledger.read_journal("sample.dat").xacts(): + for post in xact.posts(): 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 was seen in the data file. Consider this journal: -@smallexample +@smallexample @c input:validate = true (Assets:Cash) $100 @@ -8222,7 +8602,7 @@ was seen in the data file. Consider this journal: In this case, the @emph{raw} regular transaction in this file is: -@smallexample +@smallexample @c input:validate 2012-03-01 KFC Expenses:Food $100 Assets:Credit @@ -8230,7 +8610,7 @@ In this case, the @emph{raw} regular transaction in this file is: While the @emph{cooked} form is: -@smallexample +@smallexample @c input:validate 2012-03-01 KFC Expenses:Food $100 Assets:Credit $-100 @@ -8240,7 +8620,7 @@ While the @emph{cooked} form is: So the easy way to think about raw vs. cooked is that raw is the unprocessed data, and cooked has had all considerations applied. -When you traverse a Journal by iterating its transactions, you are +When you traverse a Journal by iterating over its transactions, you are generally looking at raw data. In order to look at cooked data, you must generate a report of some kind by querying the journal: @@ -8269,7 +8649,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 @@ -8350,7 +8730,7 @@ reused in other projects as needed. @item Commoditized Amounts (amount_t, commodity_t and friends) -An numerical abstraction combining multi-precision rational numbers (via +A numerical abstraction combining multi-precision rational numbers (via GMP) with commodities. These structures can be manipulated like regular numbers in either C++ or Python (as Amount objects). @@ -8406,7 +8786,7 @@ string (cash) down to the corresponding value expression @samp{(account @item Format strings -Format strings let you interpolate value expressions into string, with +Format strings let you interpolate value expressions into strings, with the requirement that any interpolated value have a string representation. Really all this does is calculate the value expression in the current report context, call the resulting value's @@ -8429,7 +8809,7 @@ amount could be an expression, etc. @item Journal transactions -Postings are owned by transactions, always. This subclass of item_t +Postings are owned by transactions, always. This subclass of @code{item_t} knows about the date, the payee, etc. If a date or metadata tag is requested from a posting and it doesn't have that information, the transaction is queried to see if it can provide it. @@ -8444,19 +8824,19 @@ it, but contains relatively little information of its own. Finally, all transactions with their postings, and all accounts, are owned by a @code{journal_t} object. This is the go-to object for -querying ad reporting on your data. +querying and reporting on your data. @item Textual journal parser -There is a textual parser, wholly contained in textual.cc, which knows -how to parse text into journal objects, which then get ``finalized'' and -added to the journal. Finalization is the step that enforces the -double-entry guarantee. +There is a textual parser, wholly contained in @file{textual.cc}, which +knows how to parse text into journal objects, which then get +``finalized'' and added to the journal. Finalization is the step that +enforces the double-entry guarantee. @item Iterators Every journal object is ``iterable'', and these iterators are defined in -iterators.h and iterators.cc. This iteration logic is kept out of the +@file{iterators.h} and @file{iterators.cc}. This iteration logic is kept out of the basic journal objects themselves for the sake of modularity. @item Comparators @@ -8469,8 +8849,8 @@ the user passed to @option{--sort @var{VEXPR}}. Many reports bring pseudo-journal objects into existence, like postings which report totals in a @samp{Total} account. These objects are -created and managed by a temporaries_t object, which gets used in many -places by the reporting filters. +created and managed by a @code{temporaries_t} object, which gets used in +many places by the reporting filters. @item Option handling @@ -8487,7 +8867,7 @@ a separate session. They are all owned by the global scope. @item Report objects -Every time you create report output, a report object is created to +Every time you create any report output, a report object is created to determine what you want to see. In the Ledger REPL, a new report object is created every time a command is executed. In CLI mode, only one report object ever comes into being, as Ledger immediately exits after @@ -8510,7 +8890,7 @@ are filters which compute the running totals; that queue and sort all the input items before playing them back out in a new order; that filter out items which fail to match a predicate, etc. Almost every reporting feature in Ledger is related to one or more filters. Looking at -@file{filters.h}, I see over 25 of them defined currently. +@file{filters.h}, there are over 25 of them defined currently. @item The filter chain @@ -8523,9 +8903,9 @@ exposed this layer to the Python bridge yet. @item Output modules Although filters are great and all, in the end you want to see stuff. -This is the job of special ``leaf'' filters call output modules. They +This is the job of special ``leaf'' filters called output modules. They are implemented just like a regular filter, but they don't have -a ``next'' filter to pass the time on down to. Instead, they are the +a ``next'' filter to pass the data on down to. Instead, they are the end of the line and must do something with the item that results in the user seeing something on their screen or in a file. @@ -8571,7 +8951,7 @@ one or more @dfn{postings}, which describe how @dfn{amounts} flow from one @dfn{account} to another. Here is an example of the simplest of journal files: -@smallexample +@smallexample @c input:validate 2010/05/31 Just an example Expenses:Some:Account $100.00 Income:Another:Account @@ -8580,9 +8960,9 @@ journal files: In this example, there is a transaction date, a payee, or description of the transaction, and two postings. The postings show movement of one hundred dollars from an account within the Income hierarchy, to the -specified expense account. The name and meaning of these accounts in +specified expense account. The name and meaning of these accounts is arbitrary, with no preferences implied, although you will find it useful -to follow standard accounting practice (@pxref{Principles of Accounting +to follow standard accounting practices (@pxref{Principles of Accounting with Ledger}). Since an amount is missing from the second posting, it is assumed to be @@ -8595,7 +8975,7 @@ It is also typical, though not enforced, to think of the first posting as the destination, and the final as the source. Thus, the amount of the first posting is typically positive. Consider: -@smallexample +@smallexample @c input:validate 2010/05/31 An income transaction Assets:Checking $1,000.00 Income:Salary @@ -8630,7 +9010,7 @@ are covered here, though it must be said that sometimes, there are multiple ways to achieve a desired result. @emph{Note:} It is important to note that there must be at least two -spaces between the end of the post and the beginning of the amount +spaces between the end of the account and the beginning of the amount (including a commodity designator). @menu @@ -8643,7 +9023,7 @@ spaces between the end of the post and the beginning of the amount In the simplest form, bare decimal numbers are accepted: -@smallexample +@smallexample @c input:validate 2010/05/31 An income transaction Assets:Checking 1000.00 Income:Salary @@ -8750,10 +9130,10 @@ amount for a posting. But what if the amount you paid for something was in one commodity, and the amount received was another? There are two main ways to express this: -@smallexample +@smallexample @c input:validate 2010/05/31 Farmer's Market Assets:My Larder 100 apples - Assets:Checking $20.00 + Assets:Checking -$20.00 @end smallexample In this example, you have paid twenty dollars for one hundred apples. @@ -8761,18 +9141,18 @@ The cost to you is twenty cents per apple, and Ledger calculates this implied cost for you. You can also make the cost explicit using a @dfn{cost amount}: -@smallexample +@smallexample @c input:validate 2010/05/31 Farmer's Market Assets:My Larder 100 apples @@ $0.200000 Assets:Checking @end smallexample Here the @dfn{per-unit cost} is given explicitly in the form of a cost -amount; and since cost amount are @emph{unobserved}, the use of six +amount; and since cost amounts are @emph{unobserved}, the use of six decimal places has no effect on how dollar amounts are displayed in the final report. You can also specify the @dfn{total cost}: -@smallexample +@smallexample @c input:validate 2010/05/31 Farmer's Market Assets:My Larder 100 apples @@@@ $20 Assets:Checking @@ -8782,7 +9162,7 @@ These three forms have identical meaning. In most cases the first is preferred, but the second two are necessary when more than two postings are involved: -@smallexample +@smallexample @c input:validate 2010/05/31 Farmer's Market Assets:My Larder 100 apples @@ $0.200000 Assets:My Larder 100 pineapples @@ $0.33 @@ -8801,14 +9181,14 @@ posting automatically so that the transaction balances. In every transaction involving more than one commodity, there is always one which is the @dfn{primary commodity}. This commodity should be thought of as the exchange commodity, or the commodity used -to buy and sells units of the other commodity. In the fruit examples +to buy and sell units of the other commodity. In the fruit examples above, dollars are the primary commodity. This is decided by Ledger -on the placement of the commodity in the transaction: +based on the placement of the commodity in the transaction: -@smallexample +@smallexample @c input:validate 2010/05/31 Sample Transaction Expenses 100 secondary - Assets 50 primary + Assets -50 primary 2010/05/31 Sample Transaction Expenses 100 secondary @@ 0.5 primary @@ -8825,7 +9205,7 @@ play is in reports that use the @option{--market (-V)} or shown. If a transaction uses only one commodity, this commodity is also -considered a primary. In fact, when Ledger goes about ensures that +considered a primary. In fact, when Ledger goes about ensuring that all transactions balance to zero, it only ever asks this of primary commodities. @@ -8858,8 +9238,8 @@ nothing for a command line user. @subsection @command{source} @findex source -The @command{source} command take a journal file as an argument and -parses it checking for errors, no other reports are generated, and no +The @command{source} command takes a journal file as an argument and +parses it checking for errors; no other reports are generated, and no other arguments are necessary. Ledger will return success if no errors are found. @@ -8880,31 +9260,33 @@ data during the run. The following are the available @var{CODES} to debug: @multitable @columnfractions .32 .43 .27 -@item @code{account.display} @tab @code{expr.calc.when} @tab @code{org.next_amount} -@item @code{accounts.sorted} @tab @code{expr.compile} @tab @code{org.next_total} -@item @code{amount.convert} @tab @code{filters.changed_value} @tab @code{parser.error} -@item @code{amount.is_zero} @tab @code{filters.changed_value.rounding} @tab @code{pool.commodities} -@item @code{amount.parse} @tab @code{filters.collapse} @tab @code{post.assign} -@item @code{amount.price} @tab @code{filters.forecast} @tab @code{python.init} -@item @code{amount.truncate} @tab @code{filters.revalued} @tab @code{python.interp} -@item @code{amount.unround} @tab @code{format.abbrev} @tab @code{query.mask} -@item @code{amounts.commodities} @tab @code{format.expr} @tab @code{report.predicate} -@item @code{amounts.refs} @tab @code{generate.post} @tab @code{scope.symbols} -@item @code{archive.journal} @tab @code{generate.post.string} @tab @code{textual.include} -@item @code{auto.columns} @tab @code{item.meta} @tab @code{textual.parse} -@item @code{budget.generate} @tab @code{ledger.read} @tab @code{timelog} -@item @code{commodity.annotated.strip} @tab @code{ledger.validate} @tab @code{times.epoch} -@item @code{commodity.annotations} @tab @code{lookup} @tab @code{times.interval} -@item @code{commodity.compare} @tab @code{lookup.account} @tab @code{times.parse} -@item @code{commodity.download} @tab @code{mask.match} @tab @code{value.sort} -@item @code{commodity.prices.add} @tab @code{memory.counts} @tab @code{value.storage.refcount} -@item @code{commodity.prices.find} @tab @code{memory.counts.live} @tab @code{xact.extend} -@item @code{convert.csv} @tab @code{memory.debug} @tab @code{xact.extend.cleared} -@item @code{csv.mappings} @tab @code{op.cons} @tab @code{xact.extend.fail} -@item @code{csv.parse} @tab @code{op.memory} @tab @code{xact.finalize} -@item @code{draft.xact} @tab @code{option.args} -@item @code{expr.calc} @tab @code{option.names} +@item @code{account.display} @tab @code{draft.xact} @tab @code{option.names} +@item @code{account.sorted} @tab @code{expr.calc} @tab @code{org.next_amount} +@item @code{amount.commodities} @tab @code{expr.compile} @tab @code{org.next_total} +@item @code{amount.convert} @tab @code{expr.merged.compile} @tab @code{parser.error} +@item @code{amount.is_zero} @tab @code{filters.changed_value} @tab @code{pool.commodities} +@item @code{amount.parse} @tab @code{filters.changed_value.rounding} @tab @code{post.assign} +@item @code{amount.price} @tab @code{filters.collapse} @tab @code{python.init} +@item @code{amount.refs} @tab @code{filters.forecast} @tab @code{python.interp} +@item @code{amount.roundto} @tab @code{filters.interval} @tab @code{query.mask} +@item @code{amount.truncate} @tab @code{filters.revalued} @tab @code{report.predicate} +@item @code{amount.unround} @tab @code{format.abbrev} @tab @code{scope.search} +@item @code{annotate.less} @tab @code{format.expr} @tab @code{scope.symbols} +@item @code{archive.journal} @tab @code{generate.post} @tab @code{select.parse} +@item @code{auto.columns} @tab @code{generate.post.string} @tab @code{textual.include} +@item @code{budget.generate} @tab @code{history.find} @tab @code{textual.parse} +@item @code{commodity.annotated.strip} @tab @code{history.map} @tab @code{timelog} +@item @code{commodity.annotations} @tab @code{item.meta} @tab @code{times.epoch} +@item @code{commodity.compare} @tab @code{ledger.read} @tab @code{times.interval} +@item @code{commodity.download} @tab @code{ledger.validate} @tab @code{times.parse} +@item @code{commodity.exchange} @tab @code{lookup} @tab @code{value.sort} +@item @code{commodity.price.find} @tab @code{lookup.account} @tab @code{value.storage.refcount} +@item @code{commodity.prices.add} @tab @code{mask.match} @tab @code{xact.extend} +@item @code{commodity.prices.find} @tab @code{memory.debug} @tab @code{xact.extend.cleared} +@item @code{csv.mappings} @tab @code{op.memory} @tab @code{xact.extend.fail} +@item @code{csv.parse} @tab @code{option.args} @tab @code{xact.finalize} @end multitable +@ @item --trace @var{INT} Enable tracing. The @var{INT} specifies the level of trace desired: @@ -8923,14 +9305,15 @@ Enable tracing. The @var{INT} specifies the level of trace desired: @item @code{LOG_TRACE} @tab 10 @item @code{LOG_ALL} @tab 11 @end multitable +@ @item --verbose Print detailed information on the execution of Ledger. @item --verify Enable additional assertions during run-time. This causes a significant -slowdown. When combined with @option{--debug @var{CODE}} ledger will produce -memory trace information. +slowdown. When combined with @option{--debug @var{CODE}} ledger will +produce memory trace information. @item --verify-memory FIX THIS ENTRY @c FIXME thdox @@ -8960,7 +9343,7 @@ apply it against a model transaction. @item generate Randomly generates syntactically valid Ledger data from a seed. Used -by the GenerateTests harness for development testing. +by the @samp{GenerateTests} harness for development testing. @item parse @var{VEXPR} @itemx expr @var{VEXPR} @@ -9034,8 +9417,8 @@ true FIX THIS ENTRY @c FIXME thdox @item template -Shows the insertion template that @command{xact} sub-command generates. -This is a debugging command. +Shows the insertion template that the @command{xact} sub-command +generates. This is a debugging command. @end ftable @@ -9054,13 +9437,13 @@ This is a debugging command. @subsection Testing Framework Ledger source ships with a fairly complete set of tests to verify that -all is well, and no old errors have been resurfaced. Tests are run +all is well, and no old errors have resurfaced. Tests are run individually with @file{ctest}. All tests can be run using @code{make check} or @code{ninja check} depending on which build tool you prefer. Once built, the ledger executable resides under the @file{build} subdirectory in the source tree. Tests are built and stored in the -test subdirectory for the build. For example, +@file{test} subdirectory for the build. For example, @file{~/ledger/build/ledger/opt/test}. @menu @@ -9071,7 +9454,7 @@ test subdirectory for the build. For example, @node Running Tests, Writing Tests, Testing Framework, Testing Framework @subsubsection Running Tests -The complete test sweet can be run from the build directory using the +The complete test suite can be run from the build directory using the check option for the build tool you use. For example, @code{make check}. The entire test suit lasts around a minute for the optimized built and many times longer for the debug version. While developing @@ -9082,9 +9465,9 @@ build location. To execute a single test use @code{ctest -V -R regex}, where the regex matches the name of the test you want to build. There are nearly 300 tests stored under the @file{test} subdirectory -in main source distribution. They are broken into two broad +in the main source distribution. They are broken into two broad categories, baseline and regression. To run the @file{5FBF2ED8} test, -for example, issue @samp{ctest -V -R "5FB"}. +for example, issue @code{ctest -V -R "5FB"}. @node Writing Tests, , Running Tests, Testing Framework @subsubsection Writing Tests @@ -9138,14 +9521,14 @@ is now @env{LEDGER_PRICE_EXP}. @end itemize -@node Example Journal File, Miscellaneous Notes, Major Changes from version 2.6, Top +@node Example Journal File, Miscellaneous Notes, Major Changes from version 2.6, Top @appendix Example Journal File The following journal file is included with the source distribution of ledger. It is called @file{drewr.dat} and exhibits many ledger features, include automatic and virtual transactions, -@smallexample +@smallexample @c input:validate ; -*- ledger -*- = /^Income/ @@ -9234,16 +9617,16 @@ to the main body of the documentation. @smallexample $ ledger --group-by "tag('trip')" bal -$ legder reg --sort "tag('foo')" %foo +$ ledger reg --sort "tag('foo')" %foo $ ledger cleared VWCU NFCU Tithe Misentry $ ledger register Joint --uncleared -$ ledger register Checking --sort d -d 'd>[2011/04/01]' until 2011/05/25 +$ ledger register Checking --sort d -d 'd>[2011/04/01]' until 2011/05/25 @end smallexample @node Ledger Files, , Invoking Ledger, Cookbook @subsection Ledger Files -@smallexample +@smallexample @c input:validate = /^Income:Taxable/ (Liabilities:Tithe Owed) -0.1 = /Noah/ diff --git a/lib/sha1.cpp b/lib/sha1.cpp deleted file mode 100644 index 1048b157..00000000 --- a/lib/sha1.cpp +++ /dev/null @@ -1,589 +0,0 @@ -/* - * sha1.cpp - * - * Copyright (C) 1998 - * Paul E. Jones <paulej@arid.us> - * All Rights Reserved. - * - ***************************************************************************** - * $Id: sha1.cpp,v 1.9 2004/03/27 18:02:20 paulej Exp $ - ***************************************************************************** - * - * Description: - * This class implements the Secure Hashing Standard as defined - * in FIPS PUB 180-1 published April 17, 1995. - * - * The Secure Hashing Standard, which uses the Secure Hashing - * Algorithm (SHA), produces a 160-bit message digest for a - * given data stream. In theory, it is highly improbable that - * two messages will produce the same message digest. Therefore, - * this algorithm can serve as a means of providing a "fingerprint" - * for a message. - * - * Portability Issues: - * SHA-1 is defined in terms of 32-bit "words". This code was - * written with the expectation that the processor has at least - * a 32-bit machine word size. If the machine word size is larger, - * the code should still function properly. One caveat to that - * is that the input functions taking characters and character arrays - * assume that only 8 bits of information are stored in each character. - * - * Caveats: - * SHA-1 is designed to work with messages less than 2^64 bits long. - * Although SHA-1 allows a message digest to be generated for - * messages of any number of bits less than 2^64, this implementation - * only works with messages with a length that is a multiple of 8 - * bits. - * - */ - - -#include "sha1.h" - -/* - * SHA1 - * - * Description: - * This is the constructor for the sha1 class. - * - * Parameters: - * None. - * - * Returns: - * Nothing. - * - * Comments: - * - */ -SHA1::SHA1() -{ - Reset(); -} - -/* - * ~SHA1 - * - * Description: - * This is the destructor for the sha1 class - * - * Parameters: - * None. - * - * Returns: - * Nothing. - * - * Comments: - * - */ -SHA1::~SHA1() -{ - // The destructor does nothing -} - -/* - * Reset - * - * Description: - * This function will initialize the sha1 class member variables - * in preparation for computing a new message digest. - * - * Parameters: - * None. - * - * Returns: - * Nothing. - * - * Comments: - * - */ -void SHA1::Reset() -{ - Length_Low = 0; - Length_High = 0; - Message_Block_Index = 0; - - H[0] = 0x67452301; - H[1] = 0xEFCDAB89; - H[2] = 0x98BADCFE; - H[3] = 0x10325476; - H[4] = 0xC3D2E1F0; - - Computed = false; - Corrupted = false; -} - -/* - * Result - * - * Description: - * This function will return the 160-bit message digest into the - * array provided. - * - * Parameters: - * message_digest_array: [out] - * This is an array of five unsigned integers which will be filled - * with the message digest that has been computed. - * - * Returns: - * True if successful, false if it failed. - * - * Comments: - * - */ -bool SHA1::Result(unsigned *message_digest_array) -{ - int i; // Counter - - if (Corrupted) - { - return false; - } - - if (!Computed) - { - PadMessage(); - Computed = true; - } - - for(i = 0; i < 5; i++) - { - message_digest_array[i] = H[i]; - } - - return true; -} - -/* - * Input - * - * Description: - * This function accepts an array of octets as the next portion of - * the message. - * - * Parameters: - * message_array: [in] - * An array of characters representing the next portion of the - * message. - * - * Returns: - * Nothing. - * - * Comments: - * - */ -void SHA1::Input( const unsigned char *message_array, - unsigned length) -{ - if (!length) - { - return; - } - - if (Computed || Corrupted) - { - Corrupted = true; - return; - } - - while(length-- && !Corrupted) - { - Message_Block[Message_Block_Index++] = (*message_array & 0xFF); - - Length_Low += 8; - Length_Low &= 0xFFFFFFFF; // Force it to 32 bits - if (Length_Low == 0) - { - Length_High++; - Length_High &= 0xFFFFFFFF; // Force it to 32 bits - if (Length_High == 0) - { - Corrupted = true; // Message is too long - } - } - - if (Message_Block_Index == 64) - { - ProcessMessageBlock(); - } - - message_array++; - } -} - -/* - * Input - * - * Description: - * This function accepts an array of octets as the next portion of - * the message. - * - * Parameters: - * message_array: [in] - * An array of characters representing the next portion of the - * message. - * length: [in] - * The length of the message_array - * - * Returns: - * Nothing. - * - * Comments: - * - */ -void SHA1::Input( const char *message_array, - unsigned length) -{ - Input(reinterpret_cast<unsigned char *>(const_cast<char *>(message_array)), length); -} - -/* - * Input - * - * Description: - * This function accepts a single octets as the next message element. - * - * Parameters: - * message_element: [in] - * The next octet in the message. - * - * Returns: - * Nothing. - * - * Comments: - * - */ -void SHA1::Input(unsigned char message_element) -{ - Input(&message_element, 1); -} - -/* - * Input - * - * Description: - * This function accepts a single octet as the next message element. - * - * Parameters: - * message_element: [in] - * The next octet in the message. - * - * Returns: - * Nothing. - * - * Comments: - * - */ -void SHA1::Input(char message_element) -{ - Input((unsigned char *) &message_element, 1); -} - -/* - * operator<< - * - * Description: - * This operator makes it convenient to provide character strings to - * the SHA1 object for processing. - * - * Parameters: - * message_array: [in] - * The character array to take as input. - * - * Returns: - * A reference to the SHA1 object. - * - * Comments: - * Each character is assumed to hold 8 bits of information. - * - */ -SHA1& SHA1::operator<<(const char *message_array) -{ - const char *p = message_array; - - while(*p) - { - Input(*p); - p++; - } - - return *this; -} - -/* - * operator<< - * - * Description: - * This operator makes it convenient to provide character strings to - * the SHA1 object for processing. - * - * Parameters: - * message_array: [in] - * The character array to take as input. - * - * Returns: - * A reference to the SHA1 object. - * - * Comments: - * Each character is assumed to hold 8 bits of information. - * - */ -SHA1& SHA1::operator<<(const unsigned char *message_array) -{ - const unsigned char *p = message_array; - - while(*p) - { - Input(*p); - p++; - } - - return *this; -} - -/* - * operator<< - * - * Description: - * This function provides the next octet in the message. - * - * Parameters: - * message_element: [in] - * The next octet in the message - * - * Returns: - * A reference to the SHA1 object. - * - * Comments: - * The character is assumed to hold 8 bits of information. - * - */ -SHA1& SHA1::operator<<(const char message_element) -{ - Input(reinterpret_cast<unsigned char *>(const_cast<char *>(&message_element)), 1); - - return *this; -} - -/* - * operator<< - * - * Description: - * This function provides the next octet in the message. - * - * Parameters: - * message_element: [in] - * The next octet in the message - * - * Returns: - * A reference to the SHA1 object. - * - * Comments: - * The character is assumed to hold 8 bits of information. - * - */ -SHA1& SHA1::operator<<(const unsigned char message_element) -{ - Input(&message_element, 1); - - return *this; -} - -/* - * ProcessMessageBlock - * - * Description: - * This function will process the next 512 bits of the message - * stored in the Message_Block array. - * - * Parameters: - * None. - * - * Returns: - * Nothing. - * - * Comments: - * Many of the variable names in this function, especially the single - * character names, were used because those were the names used - * in the publication. - * - */ -void SHA1::ProcessMessageBlock() -{ - const unsigned K[] = { // Constants defined for SHA-1 - 0x5A827999, - 0x6ED9EBA1, - 0x8F1BBCDC, - 0xCA62C1D6 - }; - int t; // Loop counter - unsigned temp; // Temporary word value - unsigned W[80]; // Word sequence - unsigned A, B, C, D, E; // Word buffers - - /* - * Initialize the first 16 words in the array W - */ - for(t = 0; t < 16; t++) - { - W[t] = ((unsigned) Message_Block[t * 4]) << 24; - W[t] |= ((unsigned) Message_Block[t * 4 + 1]) << 16; - W[t] |= ((unsigned) Message_Block[t * 4 + 2]) << 8; - W[t] |= ((unsigned) Message_Block[t * 4 + 3]); - } - - for(t = 16; t < 80; t++) - { - W[t] = CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); - } - - A = H[0]; - B = H[1]; - C = H[2]; - D = H[3]; - E = H[4]; - - for(t = 0; t < 20; t++) - { - temp = CircularShift(5,A) + ((B & C) | ((~B) & D)) + E + W[t] + K[0]; - temp &= 0xFFFFFFFF; - E = D; - D = C; - C = CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 20; t < 40; t++) - { - temp = CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1]; - temp &= 0xFFFFFFFF; - E = D; - D = C; - C = CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 40; t < 60; t++) - { - temp = CircularShift(5,A) + - ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2]; - temp &= 0xFFFFFFFF; - E = D; - D = C; - C = CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 60; t < 80; t++) - { - temp = CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3]; - temp &= 0xFFFFFFFF; - E = D; - D = C; - C = CircularShift(30,B); - B = A; - A = temp; - } - - H[0] = (H[0] + A) & 0xFFFFFFFF; - H[1] = (H[1] + B) & 0xFFFFFFFF; - H[2] = (H[2] + C) & 0xFFFFFFFF; - H[3] = (H[3] + D) & 0xFFFFFFFF; - H[4] = (H[4] + E) & 0xFFFFFFFF; - - Message_Block_Index = 0; -} - -/* - * PadMessage - * - * Description: - * According to the standard, the message must be padded to an even - * 512 bits. The first padding bit must be a '1'. The last 64 bits - * represent the length of the original message. All bits in between - * should be 0. This function will pad the message according to those - * rules by filling the message_block array accordingly. It will also - * call ProcessMessageBlock() appropriately. When it returns, it - * can be assumed that the message digest has been computed. - * - * Parameters: - * None. - * - * Returns: - * Nothing. - * - * Comments: - * - */ -void SHA1::PadMessage() -{ - /* - * Check to see if the current message block is too small to hold - * the initial padding bits and length. If so, we will pad the - * block, process it, and then continue padding into a second block. - */ - if (Message_Block_Index > 55) - { - Message_Block[Message_Block_Index++] = 0x80; - while(Message_Block_Index < 64) - { - Message_Block[Message_Block_Index++] = 0; - } - - ProcessMessageBlock(); - - while(Message_Block_Index < 56) - { - Message_Block[Message_Block_Index++] = 0; - } - } - else - { - Message_Block[Message_Block_Index++] = 0x80; - while(Message_Block_Index < 56) - { - Message_Block[Message_Block_Index++] = 0; - } - - } - - /* - * Store the message length as the last 8 octets - */ - Message_Block[56] = static_cast<unsigned char>((Length_High >> 24) & 0xFF); - Message_Block[57] = static_cast<unsigned char>((Length_High >> 16) & 0xFF); - Message_Block[58] = static_cast<unsigned char>((Length_High >> 8) & 0xFF); - Message_Block[59] = static_cast<unsigned char>((Length_High) & 0xFF); - Message_Block[60] = static_cast<unsigned char>((Length_Low >> 24) & 0xFF); - Message_Block[61] = static_cast<unsigned char>((Length_Low >> 16) & 0xFF); - Message_Block[62] = static_cast<unsigned char>((Length_Low >> 8) & 0xFF); - Message_Block[63] = static_cast<unsigned char>((Length_Low) & 0xFF); - - ProcessMessageBlock(); -} - - -/* - * CircularShift - * - * Description: - * This member function will perform a circular shifting operation. - * - * Parameters: - * bits: [in] - * The number of bits to shift (1-31) - * word: [in] - * The value to shift (assumes a 32-bit integer) - * - * Returns: - * The shifted value. - * - * Comments: - * - */ -unsigned SHA1::CircularShift(int bits, unsigned word) -{ - return ((word << bits) & 0xFFFFFFFF) | ((word & 0xFFFFFFFF) >> (32-bits)); -} diff --git a/lib/sha1.h b/lib/sha1.h deleted file mode 100644 index 0a12d0f3..00000000 --- a/lib/sha1.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * sha1.h - * - * Copyright (C) 1998 - * Paul E. Jones <paulej@arid.us> - * All Rights Reserved. - * - ***************************************************************************** - * $Id: sha1.h,v 1.6 2004/03/27 18:02:26 paulej Exp $ - ***************************************************************************** - * - * Description: - * This class implements the Secure Hashing Standard as defined - * in FIPS PUB 180-1 published April 17, 1995. - * - * Many of the variable names in this class, especially the single - * character names, were used because those were the names used - * in the publication. - * - * Please read the file sha1.cpp for more information. - * - */ - -#ifndef _SHA1_H_ -#define _SHA1_H_ - -class SHA1 -{ - - public: - - SHA1(); - virtual ~SHA1(); - - /* - * Re-initialize the class - */ - void Reset(); - - /* - * Returns the message digest - */ - bool Result(unsigned *message_digest_array); - - /* - * Provide input to SHA1 - */ - void Input( const unsigned char *message_array, - unsigned length); - void Input( const char *message_array, - unsigned length); - void Input(unsigned char message_element); - void Input(char message_element); - SHA1& operator<<(const char *message_array); - SHA1& operator<<(const unsigned char *message_array); - SHA1& operator<<(const char message_element); - SHA1& operator<<(const unsigned char message_element); - - private: - - /* - * Process the next 512 bits of the message - */ - void ProcessMessageBlock(); - - /* - * Pads the current message block to 512 bits - */ - void PadMessage(); - - /* - * Performs a circular left shift operation - */ - inline unsigned CircularShift(int bits, unsigned word); - - unsigned H[5]; // Message digest buffers - - unsigned Length_Low; // Message length in bits - unsigned Length_High; // Message length in bits - - unsigned char Message_Block[64]; // 512-bit message blocks - int Message_Block_Index; // Index into message block array - - bool Computed; // Is the digest computed? - bool Corrupted; // Is the message digest corruped? - -}; - -#endif diff --git a/lisp/CMakeLists.txt b/lisp/CMakeLists.txt index 33fe6f14..9dee2abb 100644 --- a/lisp/CMakeLists.txt +++ b/lisp/CMakeLists.txt @@ -2,9 +2,12 @@ set(EMACS_LISP_SOURCES ledger-commodities.el ledger-complete.el ledger-exec.el + ledger-fontify.el ledger-fonts.el + ledger-fontify.el ledger-init.el ledger-mode.el + ledger-navigate.el ledger-occur.el ledger-post.el ledger-reconcile.el @@ -17,6 +20,9 @@ set(EMACS_LISP_SOURCES ledger-texi.el ledger-xact.el) +set(EMACS_LISP_SOURCES_UNCOMPILABLE + ledger-context.el) + # find emacs and complain if not found find_program(EMACS_EXECUTABLE emacs) @@ -36,7 +42,14 @@ macro(add_emacs_lisp_target el) COMMENT "Creating byte-compiled Emacs lisp ${CMAKE_CURRENT_BINARY_DIR}/${el}c") endmacro(add_emacs_lisp_target el) -if(EMACS_EXECUTABLE) +if (EMACS_EXECUTABLE) + # uncompilable .el files + foreach(el ${EMACS_LISP_SOURCES_UNCOMPILABLE}) + configure_file(${el} ${CMAKE_CURRENT_BINARY_DIR}/${el}) + list(APPEND EMACS_LISP_UNCOMPILABLE ${CMAKE_CURRENT_BINARY_DIR}/${el}) + endforeach() + + # compilable .el files foreach(el ${EMACS_LISP_SOURCES}) add_emacs_lisp_target(${el}) list(APPEND EMACS_LISP_BINARIES ${CMAKE_CURRENT_BINARY_DIR}/${el}c) @@ -45,8 +58,8 @@ if(EMACS_EXECUTABLE) add_custom_target(emacs_lisp_byte_compile ALL DEPENDS ${EMACS_LISP_BINARIES}) # install the byte-compiled emacs-lisp sources - install(FILES ${EMACS_LISP_SOURCES} ${EMACS_LISP_BINARIES} - DESTINATION share/emacs/site-lisp) + install(FILES ${EMACS_LISP_SOURCES} ${EMACS_LISP_BINARIES} ${EMACS_LISP_UNCOMPILABLE} + DESTINATION share/emacs/site-lisp/ledger-mode) endif() ### CMakeLists.txt ends here diff --git a/lisp/ledger-commodities.el b/lisp/ledger-commodities.el index 48d41979..5ffebf3b 100644 --- a/lisp/ledger-commodities.el +++ b/lisp/ledger-commodities.el @@ -1,6 +1,6 @@ ;;; ledger-commodities.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. ;;; Commentary: ;; Helper functions to deal with commoditized numbers. A commoditized @@ -33,114 +33,108 @@ :type 'string :group 'ledger-reconcile) -(defcustom ledger-scale 10000 - "The 10 ^ maximum number of digits you would expect to appear in your reports. -This is a cheap way of getting around floating point silliness in subtraction") - (defun ledger-split-commodity-string (str) "Split a commoditized string, STR, into two parts. Returns a list with (value commodity)." (let ((number-regex (if (assoc "decimal-comma" ledger-environment-alist) - ledger-amount-decimal-comma-regex - ledger-amount-decimal-period-regex))) - (if (> (length str) 0) - (with-temp-buffer - (insert str) - (goto-char (point-min)) - (cond - ((re-search-forward "\"\\(.*\\)\"" nil t) ; look for quoted commodities - (let ((com (delete-and-extract-region - (match-beginning 1) - (match-end 1)))) - (if (re-search-forward - number-regex nil t) - (list - (ledger-string-to-number - (delete-and-extract-region (match-beginning 0) (match-end 0))) - com)))) - ((re-search-forward number-regex nil t) - ;; found a number in the current locale, return it in the - ;; car. Anything left over is annotation, the first - ;; thing should be the commodity, separated by - ;; whitespace, return it in the cdr. I can't think of - ;; any counterexamples - (list - (ledger-string-to-number - (delete-and-extract-region (match-beginning 0) (match-end 0))) - (nth 0 (split-string (buffer-substring-no-properties (point-min) (point-max)))))) - ((re-search-forward "0" nil t) - ;; couldn't find a decimal number, look for a single 0, - ;; indicating account with zero balance - (list 0 ledger-reconcile-default-commodity)))) - ;; nothing found, return 0 - (list 0 ledger-reconcile-default-commodity)))) + ledger-amount-decimal-comma-regex + ledger-amount-decimal-period-regex))) + (if (> (length str) 0) + (with-temp-buffer + (insert str) + (goto-char (point-min)) + (cond + ((re-search-forward "\"\\(.*\\)\"" nil t) ; look for quoted commodities + (let ((com (delete-and-extract-region + (match-beginning 1) + (match-end 1)))) + (if (re-search-forward + number-regex nil t) + (list + (ledger-string-to-number + (delete-and-extract-region (match-beginning 0) (match-end 0))) + com)))) + ((re-search-forward number-regex nil t) + ;; found a number in the current locale, return it in the + ;; car. Anything left over is annotation, the first + ;; thing should be the commodity, separated by + ;; whitespace, return it in the cdr. I can't think of + ;; any counterexamples + (list + (ledger-string-to-number + (delete-and-extract-region (match-beginning 0) (match-end 0))) + (nth 0 (split-string (buffer-substring-no-properties (point-min) (point-max)))))) + ((re-search-forward "0" nil t) + ;; couldn't find a decimal number, look for a single 0, + ;; indicating account with zero balance + (list 0 ledger-reconcile-default-commodity)))) + ;; nothing found, return 0 + (list 0 ledger-reconcile-default-commodity)))) (defun ledger-string-balance-to-commoditized-amount (str) "Return a commoditized amount (val, 'comm') from STR." - ; break any balances with multi commodities into a list + ; break any balances with multi commodities into a list (mapcar #'(lambda (st) - (ledger-split-commodity-string st)) - (split-string str "[\n\r]"))) + (ledger-split-commodity-string st)) + (split-string str "[\n\r]"))) (defun -commodity (c1 c2) "Subtract C2 from C1, ensuring their commodities match." (if (string= (cadr c1) (cadr c2)) - ; the scaling below is to get around inexact subtraction results where, for example - ; 1.23 - 4.56 = -3.3299999999999996 instead of -3.33 - (list (/ (- (* ledger-scale (car c1)) (* ledger-scale (car c2))) ledger-scale) (cadr c1)) - (error "Can't subtract different commodities %S from %S" c2 c1))) + (list (-(car c1) (car c2)) (cadr c1)) + (error "Can't subtract different commodities %S from %S" c2 c1))) (defun +commodity (c1 c2) "Add C1 and C2, ensuring their commodities match." (if (string= (cadr c1) (cadr c2)) (list (+ (car c1) (car c2)) (cadr c1)) - (error "Can't add different commodities, %S to %S" c1 c2))) + (error "Can't add different commodities, %S to %S" c1 c2))) (defun ledger-strip (str char) - (let (new-str) - (concat (dolist (ch (append str nil) new-str) - (unless (= ch char) - (setq new-str (append new-str (list ch)))))))) + "Return STR with CHAR removed." + (replace-regexp-in-string char "" str)) (defun ledger-string-to-number (str &optional decimal-comma) - "improve builtin string-to-number by handling internationalization, and return nil if number can't be parsed" - (let ((nstr (if (or decimal-comma - (assoc "decimal-comma" ledger-environment-alist)) - (ledger-strip str ?.) - (ledger-strip str ?,)))) - (while (string-match "," nstr) ;if there is a comma now, it is a thousands separator - (setq nstr (replace-match "." nil nil nstr))) - (string-to-number nstr))) + "improve builtin string-to-number by handling internationalization, and return nil if number can't be parsed" + (let ((nstr (if (or decimal-comma + (assoc "decimal-comma" ledger-environment-alist)) + (ledger-strip str ".") + (ledger-strip str ",")))) + (while (string-match "," nstr) ;if there is a comma now, it is a thousands separator + (setq nstr (replace-match "." nil nil nstr))) + (string-to-number nstr))) (defun ledger-number-to-string (n &optional decimal-comma) - (let ((str (number-to-string n))) - (if (or decimal-comma - (assoc "decimal-comma" ledger-environment-alist)) - (while (string-match "\\." str) - (setq str (replace-match "," nil nil str))) - str))) + "number-to-string that handles comma as decimal." + (let ((str (number-to-string n))) + (when (or decimal-comma + (assoc "decimal-comma" ledger-environment-alist)) + (while (string-match "\\." str) + (setq str (replace-match "," nil nil str)))) + str)) (defun ledger-commodity-to-string (c1) "Return string representing C1. Single character commodities are placed ahead of the value, longer ones are after the value." - (let ((str (ledger-number-to-string (car c1))) - (commodity (cadr c1))) - (if (> (length commodity) 1) - (concat str " " commodity) + (let ((str (ledger-number-to-string (car c1))) + (commodity (cadr c1))) + (if (> (length commodity) 1) + (concat str " " commodity) (concat commodity " " str)))) (defun ledger-read-commodity-string (prompt) + "Read an amount from mini-buffer using PROMPT." (let ((str (read-from-minibuffer - (concat prompt " (" ledger-reconcile-default-commodity "): "))) - comm) + (concat prompt " (" ledger-reconcile-default-commodity "): "))) + comm) (if (and (> (length str) 0) - (ledger-split-commodity-string str)) - (progn - (setq comm (ledger-split-commodity-string str)) - (if (cadr comm) - comm - (list (car comm) ledger-reconcile-default-commodity)))))) + (ledger-split-commodity-string str)) + (progn + (setq comm (ledger-split-commodity-string str)) + (if (cadr comm) + comm + (list (car comm) ledger-reconcile-default-commodity)))))) (provide 'ledger-commodities) diff --git a/lisp/ledger-complete.el b/lisp/ledger-complete.el index a8ef9a8a..2fae9911 100644 --- a/lisp/ledger-complete.el +++ b/lisp/ledger-complete.el @@ -1,6 +1,6 @@ ;;; ledger-complete.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. ;;; Commentary: ;; Functions providing payee and account auto complete. @@ -34,8 +34,8 @@ ;; with pcomplete. See pcomplete-parse-arguments-function for ;; details (let* ((begin (save-excursion - (ledger-thing-at-point) ;; leave point at beginning of thing under point - (point))) + (ledger-thing-at-point) ;; leave point at beginning of thing under point + (point))) (end (point)) begins args) ;; to support end of line metadata @@ -65,57 +65,42 @@ (unless (and (>= origin (match-beginning 0)) (< origin (match-end 0))) (setq payees-list (cons (match-string-no-properties 3) - payees-list))))) ;; add the payee - ;; to the list + payees-list))))) ;; add the payee + ;; to the list (pcomplete-uniqify-list (nreverse payees-list)))) (defun ledger-find-accounts-in-buffer () - (interactive) - (let ((origin (point)) - accounts - (account-tree (list t)) - (account-elements nil) - (seed-regex (ledger-account-any-status-with-seed-regex - (regexp-quote (car pcomplete-args))))) - (save-excursion - (goto-char (point-min)) - - (dolist (account - (delete-dups - (progn - (while (re-search-forward seed-regex nil t) - (unless (between origin (match-beginning 0) (match-end 0)) - (setq accounts (cons (match-string-no-properties 2) accounts)))) - accounts))) - (let ((root account-tree)) - (setq account-elements - (split-string - account ":")) - (while account-elements - (let ((xact (assoc (car account-elements) root))) - (if xact - (setq root (cdr xact)) - (setq xact (cons (car account-elements) (list t))) - (nconc root (list xact)) - (setq root (cdr xact)))) - (setq account-elements (cdr account-elements)))))) - account-tree)) - -(defun ledger-find-metadata-in-buffer () - "Search through buffer and build list of metadata. -Return list." - (let ((origin (point)) accounts) + (interactive) + (let ((origin (point)) + accounts + (account-tree (list t)) + (account-elements nil) + (seed-regex (ledger-account-any-status-with-seed-regex + (regexp-quote (car pcomplete-args))))) (save-excursion - (setq ledger-account-tree (list t)) (goto-char (point-min)) - (while (re-search-forward - ledger-metadata-regex - nil t) - (unless (and (>= origin (match-beginning 0)) - (< origin (match-end 0))) - (setq accounts (cons (match-string-no-properties 2) accounts))))) - accounts)) + + (dolist (account + (delete-dups + (progn + (while (re-search-forward seed-regex nil t) + (unless (between origin (match-beginning 0) (match-end 0)) + (setq accounts (cons (match-string-no-properties 2) accounts)))) + accounts))) + (let ((root account-tree)) + (setq account-elements + (split-string + account ":")) + (while account-elements + (let ((xact (assoc (car account-elements) root))) + (if xact + (setq root (cdr xact)) + (setq xact (cons (car account-elements) (list t))) + (nconc root (list xact)) + (setq root (cdr xact)))) + (setq account-elements (cdr account-elements)))))) + account-tree)) (defun ledger-accounts () "Return a tree of all accounts in the buffer." @@ -129,19 +114,19 @@ Return list." (setq prefix (concat prefix (and prefix ":") (car elements)) root (cdr xact)) - (setq root nil elements nil))) + (setq root nil elements nil))) (setq elements (cdr elements))) (setq root (delete (list (car elements) t) root)) (and root (sort (mapcar (function (lambda (x) - (let ((term (if prefix - (concat prefix ":" (car x)) - (car x)))) - (if (> (length (cdr x)) 1) - (concat term ":") - term)))) + (let ((term (if prefix + (concat prefix ":" (car x)) + (car x)))) + (if (> (length (cdr x)) 1) + (concat term ":") + term)))) (cdr root)) 'string-lessp)))) @@ -155,39 +140,42 @@ Return list." (delete (caar (ledger-parse-arguments)) (ledger-payees-in-buffer)) ;; this completes against payee names - (progn - (let ((text (buffer-substring-no-properties - (line-beginning-position) - (line-end-position)))) - (delete-region (line-beginning-position) - (line-end-position)) - (condition-case nil - (ledger-add-transaction text t) - (error nil))) - (forward-line) - (goto-char (line-end-position)) - (search-backward ";" (line-beginning-position) t) - (skip-chars-backward " \t0123456789.,") - (throw 'pcompleted t))) - (ledger-accounts))))) + (progn + (let ((text (buffer-substring-no-properties + (line-beginning-position) + (line-end-position)))) + (delete-region (line-beginning-position) + (line-end-position)) + (condition-case nil + (ledger-add-transaction text t) + (error nil))) + (forward-line) + (goto-char (line-end-position)) + (search-backward ";" (line-beginning-position) t) + (skip-chars-backward " \t0123456789.,") + (throw 'pcompleted t))) + (ledger-accounts))))) + +(defun ledger-trim-trailing-whitespace (str) + (replace-regexp-in-string "[ \t]*$" "" str)) (defun ledger-fully-complete-xact () "Completes a transaction if there is another matching payee in the buffer. Does not use ledger xact" (interactive) - (let* ((name (caar (ledger-parse-arguments))) - (rest-of-name name) - xacts) + (let* ((name (ledger-trim-trailing-whitespace (caar (ledger-parse-arguments)))) + (rest-of-name name) + xacts) (save-excursion (when (eq 'transaction (ledger-thing-at-point)) - (delete-region (point) (+ (length name) (point))) - ;; Search backward for a matching payee + (delete-region (point) (+ (length name) (point))) + ;; Search backward for a matching payee (when (re-search-backward (concat "^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+\\(.*" (regexp-quote name) ".*\\)" ) nil t) - (setq rest-of-name (match-string 3)) + (setq rest-of-name (match-string 3)) ;; Start copying the postings - (forward-line) + (forward-line) (while (looking-at ledger-account-any-status-regex) (setq xacts (cons (buffer-substring-no-properties (line-beginning-position) @@ -198,7 +186,7 @@ Does not use ledger xact" ;; Insert rest-of-name and the postings (when xacts (save-excursion - (insert rest-of-name ?\n) + (insert rest-of-name ?\n) (while xacts (insert (car xacts) ?\n) (setq xacts (cdr xacts)))) @@ -208,49 +196,55 @@ Does not use ledger xact" (goto-char (match-end 0)))))) +(defcustom ledger-complete-ignore-case t + "Non-nil means that ledger-complete-at-point will be case-insensitive" + :type 'boolean + :group 'ledger) + (defun ledger-pcomplete (&optional interactively) "Complete rip-off of pcomplete from pcomplete.el, only added ledger-magic-tab in the previous commands list so that ledger-magic-tab would cycle properly" (interactive "p") - (if (and interactively - pcomplete-cycle-completions - pcomplete-current-completions - (memq last-command '(ledger-magic-tab - ledger-pcomplete - pcomplete-expand-and-complete - pcomplete-reverse))) - (progn - (delete-backward-char pcomplete-last-completion-length) - (if (eq this-command 'pcomplete-reverse) - (progn - (push (car (last pcomplete-current-completions)) - pcomplete-current-completions) - (setcdr (last pcomplete-current-completions 2) nil)) - (nconc pcomplete-current-completions - (list (car pcomplete-current-completions))) - (setq pcomplete-current-completions - (cdr pcomplete-current-completions))) - (pcomplete-insert-entry pcomplete-last-completion-stub - (car pcomplete-current-completions) - nil pcomplete-last-completion-raw)) - (setq pcomplete-current-completions nil - pcomplete-last-completion-raw nil) - (catch 'pcompleted - (let* ((pcomplete-stub) - pcomplete-seen pcomplete-norm-func - pcomplete-args pcomplete-last pcomplete-index - (pcomplete-autolist pcomplete-autolist) - (pcomplete-suffix-list pcomplete-suffix-list) + (let ((pcomplete-ignore-case ledger-complete-ignore-case)) + (if (and interactively + pcomplete-cycle-completions + pcomplete-current-completions + (memq last-command '(ledger-magic-tab + ledger-pcomplete + pcomplete-expand-and-complete + pcomplete-reverse))) + (progn + (delete-char (* -1 pcomplete-last-completion-length)) + (if (eq this-command 'pcomplete-reverse) + (progn + (push (car (last pcomplete-current-completions)) + pcomplete-current-completions) + (setcdr (last pcomplete-current-completions 2) nil)) + (nconc pcomplete-current-completions + (list (car pcomplete-current-completions))) + (setq pcomplete-current-completions + (cdr pcomplete-current-completions))) + (pcomplete-insert-entry pcomplete-last-completion-stub + (car pcomplete-current-completions) + nil pcomplete-last-completion-raw)) + (setq pcomplete-current-completions nil + pcomplete-last-completion-raw nil) + (catch 'pcompleted + (let* (pcomplete-stub + pcomplete-seen pcomplete-norm-func + pcomplete-args pcomplete-last pcomplete-index + pcomplete-autolist (completions (pcomplete-completions)) - (result (pcomplete-do-complete pcomplete-stub completions))) - (and result - (not (eq (car result) 'listed)) - (cdr result) - (pcomplete-insert-entry pcomplete-stub (cdr result) - (memq (car result) - '(sole shortest)) - pcomplete-last-completion-raw)))))) + (result (pcomplete-do-complete pcomplete-stub completions)) + (pcomplete-termination-string "")) + (and result + (not (eq (car result) 'listed)) + (cdr result) + (pcomplete-insert-entry pcomplete-stub (cdr result) + (memq (car result) + '(sole shortest)) + pcomplete-last-completion-raw))))))) (provide 'ledger-complete) diff --git a/lisp/ledger-context.el b/lisp/ledger-context.el index b1bcd870..0dfa4645 100644 --- a/lisp/ledger-context.el +++ b/lisp/ledger-context.el @@ -1,6 +1,6 @@ ;;; ledger-context.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. ;;; Commentary: @@ -28,56 +28,45 @@ (eval-when-compile (require 'cl)) -;; *-string constants are assembled in the single-line-config macro to -;; form the regex and list of elements -(defconst indent-string "\\(^[ \t]+\\)") -(defconst status-string "\\([*! ]?\\)") -(defconst account-string "[\\[(]?\\(.*?\\)[])]?") -(defconst amount-string "[ \t]?\\(-?[0-9]+\\.[0-9]*\\)") -(defconst comment-string "[ \t]*;[ \t]*\\(.*?\\)") -(defconst nil-string "\\([ \t]+\\)") -(defconst commodity-string "\\(.+?\\)") -(defconst date-string "^\\([0-9]\\{4\\}[/-][01]?[0-9][/-][0123]?[0-9]\\)") -(defconst code-string "\\((.*)\\)?") -(defconst payee-string "\\(.*\\)") - -(defmacro line-regex (&rest elements) - (let (regex-string) - (concat (dolist (e elements regex-string) - (setq regex-string - (concat regex-string - (eval - (intern - (concat (symbol-name e) "-string")))))) "[ \t]*$"))) - -(defmacro 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 (symbol-name e) "-string")))))) "[ \t]*$") - ,elements))) - -(defmacro single-line-config (&rest elements) +;; ledger-*-string constants are assembled in the +;; `ledger-single-line-config' macro to form the regex and list of +;; elements +(defconst ledger-indent-string "\\(^[ \t]+\\)") +(defconst ledger-status-string "\\([*! ]?\\)") +(defconst ledger-account-string "[\\[(]?\\(.*?\\)[])]?") +(defconst ledger-separator-string "\\s-\\s-") +(defconst ledger-amount-string "\\(-?[0-9]+[\\.,][0-9]*\\)") +(defconst ledger-comment-string "[ \t]*;[ \t]*\\(.*?\\)") +(defconst ledger-nil-string "\\([ \t]\\)") +(defconst ledger-commodity-string "\\(.+?\\)") +(defconst ledger-date-string "^\\([0-9]\\{4\\}[/-][01]?[0-9][/-][0123]?[0-9]\\)") +(defconst ledger-code-string "\\((.*)\\)?") +(defconst ledger-payee-string "\\(.*\\)") + +(defun ledger-get-regex-str (name) + "Get the ledger regex of type NAME." + (symbol-value (intern (concat "ledger-" (symbol-name name) "-string")))) + +(defun ledger-line-regex (elements) + "Get a regex to match ELEMENTS on a single line." + (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 `(line-regex ,@elements)) - ,elements)) + `(list (ledger-line-regex (quote ,elements)) (quote ,elements))) (defconst ledger-line-config - (list (list 'xact (list (single-line-config date nil status nil code nil payee nil comment) - (single-line-config date nil status nil code nil payee) - (single-line-config date nil status nil payee))) - (list 'acct-transaction (list (single-line-config indent comment) - (single-line-config2 indent status account nil commodity amount nil comment) - (single-line-config2 indent status account nil commodity amount) - (single-line-config2 indent status account nil amount nil commodity comment) - (single-line-config2 indent status account nil amount nil commodity) - (single-line-config2 indent status account nil amount) - (single-line-config2 indent status account nil comment) - (single-line-config2 indent status account))))) + (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-config indent status account separator commodity amount nil comment) + (ledger-single-line-config indent status account separator commodity amount) + (ledger-single-line-config indent status account separator amount nil commodity comment) + (ledger-single-line-config indent status account separator amount nil commodity) + (ledger-single-line-config indent status account separator amount) + (ledger-single-line-config indent status account separator 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. @@ -111,9 +100,9 @@ Leave point at the beginning of the thing under point" (let ((here (point))) (goto-char (line-beginning-position)) (cond ((looking-at "^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.+?)\\)?\\s-+") - (goto-char (match-end 0)) + (goto-char (match-end 0)) 'transaction) - ((looking-at "^\\s-+\\([*!]\\s-+\\)?[[(]?\\(.\\)") + ((looking-at "^\\s-+\\([*!]\\s-+\\)?[[(]?\\([^\\s-]\\)") (goto-char (match-beginning 2)) 'posting) ((looking-at "^\\(sun\\|mon\\|tue\\|wed\\|thu\\|fri\\|sat\\)\\s-+") @@ -176,7 +165,7 @@ specified line, returns nil." (let ((left (forward-line offset))) (if (not (equal left 0)) nil - (ledger-context-at-point))))) + (ledger-context-at-point))))) (defun ledger-context-line-type (context-info) (nth 0 context-info)) @@ -208,4 +197,4 @@ specified line, returns nil." (provide 'ledger-context) -;;; ledger-report.el ends here +;;; ledger-context.el ends here diff --git a/lisp/ledger-exec.el b/lisp/ledger-exec.el index 95b28ec2..8902d839 100644 --- a/lisp/ledger-exec.el +++ b/lisp/ledger-exec.el @@ -1,6 +1,6 @@ ;;; ledger-exec.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. ;;; Commentary: @@ -36,9 +36,9 @@ :group 'ledger) (defcustom ledger-mode-should-check-version t - "Should Ledger-mode verify that the executable is working" - :type 'boolean - :group 'ledger-exec) + "Should Ledger-mode verify that the executable is working?" + :type 'boolean + :group 'ledger-exec) (defcustom ledger-binary-path "ledger" "Path to the ledger executable." @@ -53,29 +53,30 @@ (setq buffer-read-only t))) (defun ledger-exec-success-p (ledger-output-buffer) + "Return t if the ledger output in LEDGER-OUTPUT-BUFFER is successful." (with-current-buffer ledger-output-buffer (goto-char (point-min)) (if (and (> (buffer-size) 1) (looking-at (regexp-quote "While"))) - nil ;; failure, there is an error starting with "While" - ledger-output-buffer))) + nil ;; failure, there is an error starting with "While" + ledger-output-buffer))) (defun ledger-exec-ledger (input-buffer &optional output-buffer &rest args) "Run Ledger using INPUT-BUFFER and optionally capturing output in OUTPUT-BUFFER with ARGS." (if (null ledger-binary-path) (error "The variable `ledger-binary-path' has not been set") - (let ((buf (or input-buffer (current-buffer))) - (outbuf (or output-buffer - (generate-new-buffer " *ledger-tmp*")))) - (with-current-buffer buf - (let ((coding-system-for-write 'utf-8) - (coding-system-for-read 'utf-8)) - (apply #'call-process-region - (append (list (point-min) (point-max) - ledger-binary-path nil outbuf nil "-f" "-") - args))) - (if (ledger-exec-success-p outbuf) - outbuf - (ledger-exec-handle-error outbuf)))))) + (let ((buf (or input-buffer (current-buffer))) + (outbuf (or output-buffer + (generate-new-buffer " *ledger-tmp*")))) + (with-current-buffer buf + (let ((coding-system-for-write 'utf-8) + (coding-system-for-read 'utf-8)) + (apply #'call-process-region + (append (list (point-min) (point-max) + ledger-binary-path nil outbuf nil "-f" "-") + args))) + (if (ledger-exec-success-p outbuf) + outbuf + (ledger-exec-handle-error outbuf)))))) (defun ledger-version-greater-p (needed) "Verify the ledger binary is usable for `ledger-mode' (version greater than NEEDED)." @@ -83,25 +84,24 @@ (version-strings '())) (with-temp-buffer (when (ledger-exec-ledger (current-buffer) (current-buffer) "--version") - (goto-char (point-min)) - (delete-horizontal-space) - (setq version-strings (split-string - (buffer-substring-no-properties (point) - (point-max)))) - (if (and (string-match (regexp-quote "Ledger") (car version-strings)) - (or (string= needed (cadr version-strings)) - (string< needed (cadr version-strings)))) - t ;; success - nil))))) ;;failure + (goto-char (point-min)) + (delete-horizontal-space) + (setq version-strings (split-string + (buffer-substring-no-properties (point) + (point-max)))) + (if (and (string-match (regexp-quote "Ledger") (car version-strings)) + (or (string= needed (cadr version-strings)) + (string< needed (cadr version-strings)))) + t ;; success + nil))))) ;;failure (defun ledger-check-version () "Verify that ledger works and is modern enough." (interactive) - (if ledger-mode-should-check-version - (if (setq ledger-works (ledger-version-greater-p ledger-version-needed)) - (message "Good Ledger Version") - (message "Bad Ledger Version")) - setq ledger-works t)) + (if ledger-mode-should-check-version + (if (setq ledger-works (ledger-version-greater-p ledger-version-needed)) + (message "Good Ledger Version") + (message "Bad Ledger Version")))) (provide 'ledger-exec) diff --git a/lisp/ledger-fontify.el b/lisp/ledger-fontify.el new file mode 100644 index 00000000..d307208f --- /dev/null +++ b/lisp/ledger-fontify.el @@ -0,0 +1,199 @@ +;;; ledger-fontify.el --- Provide custom fontification for ledger-mode + + +;; Copyright (C) 2014 Craig P. Earls (enderw88 at gmail dot com) + +;; This file is not part of GNU Emacs. + +;; This is free software; you can redistribute it and/or modify it under +;; the terms of the GNU General Public License as published by the Free +;; Software Foundation; either version 2, or (at your option) any later +;; version. +;; +;; This is distributed in the hope that it will be useful, but WITHOUT +;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +;; for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. + +;;; Commentary: +;; Font-lock-mode doesn't handle multiline syntax very well. This +;; code provides font lock that is sensitive to overall transaction +;; states + + +;;; Code: + +(require 'ledger-navigate) +(require 'ledger-regex) +(require 'ledger-state) + +(defcustom ledger-fontify-xact-state-overrides nil + "If t the highlight entire xact with state." + :type 'boolean + :group 'ledger) + +(defun ledger-fontify-buffer-part (&optional beg end len) +"Fontify buffer from BEG to END, length LEN." + (save-excursion + (unless beg (setq beg (point-min))) + (unless end (setq end (point-max))) + (beginning-of-line) + (while (< (point) end) + (cond ((or (looking-at ledger-xact-start-regex) + (looking-at ledger-posting-regex)) + (ledger-fontify-xact-at (point))) + ((looking-at ledger-directive-start-regex) + (ledger-fontify-directive-at (point)))) + (ledger-navigate-next-xact-or-directive)))) + +(defun ledger-fontify-xact-at (position) + "Fontify the xact at POSITION." + (interactive "d") + (save-excursion + (goto-char position) + (let ((extents (ledger-navigate-find-element-extents position)) + (state (ledger-transaction-state))) + (if (and ledger-fontify-xact-state-overrides state) + (cond ((eq state 'cleared) + (ledger-fontify-set-face extents 'ledger-font-xact-cleared-face)) + ((eq state 'pending) + (ledger-fontify-set-face extents 'ledger-font-xact-pending-face))) + (ledger-fontify-xact-by-line extents))))) + +(defun ledger-fontify-xact-by-line (extents) + "Do line-by-line detailed fontification of xact in EXTENTS." + (save-excursion + (ledger-fontify-xact-start (car extents)) + (while (< (point) (cadr extents)) + (if (looking-at "[ \t]+;") + (ledger-fontify-set-face (list (point) (progn + (end-of-line) + (point))) 'ledger-font-comment-face) + (ledger-fontify-posting (point))) + (forward-line)))) + +(defun ledger-fontify-xact-start (pos) + "POS should be at the beginning of a line starting an xact. +Fontify the first line of an xact" + (goto-char pos) + (let ((line-start (line-beginning-position))) + (goto-char line-start) + (re-search-forward "[ \t]") + (ledger-fontify-set-face (list line-start (match-beginning 0)) 'ledger-font-posting-date-face) + (goto-char line-start) + (re-search-forward ledger-xact-after-date-regex) + (let ((state (save-match-data (ledger-state-from-string (match-string 1))))) + (ledger-fontify-set-face (list (match-beginning 3) (match-end 3)) + (cond ((eq state 'pending) + 'ledger-font-payee-pending-face) + ((eq state 'cleared) + 'ledger-font-payee-cleared-face) + (t + 'ledger-font-payee-uncleared-face)))) + (when (match-beginning 4) + (ledger-fontify-set-face (list (match-beginning 4) + (match-end 4)) 'ledger-font-comment-face)) + (forward-line))) + +(defun ledger-fontify-posting (pos) + "Fontify the posting at POS." + (let* ((state nil) + (end-of-line-comment nil) + (end (progn (end-of-line) + (point))) + (start (progn (beginning-of-line) + (point)))) + + ;; Look for a posting status flag + (set-match-data nil 'reseat) + (re-search-forward " \\([*!]\\) " end t) + (if (match-string 1) + (setq state (ledger-state-from-string (match-string 1)))) + (beginning-of-line) + (re-search-forward "[[:graph:]]\\([ \t][ \t]\\)" end 'end) ;; find the end of the account, or end of line + + (when (<= (point) end) ;; we are still on the line + (ledger-fontify-set-face (list start (point)) + (cond ((eq state 'cleared) + 'ledger-font-posting-account-cleared-face) + ((eq state 'pending) + 'ledger-font-posting-account-pending-face) + (t + 'ledger-font-posting-account-face))) + + + (when (< (point) end) ;; there is still more to fontify + (setq start (point)) ;; update start of next font region + (setq end-of-line-comment (re-search-forward ";" end 'end)) ;; find the end of the line, or start of a comment + (ledger-fontify-set-face (list start (point) ) + (cond ((eq state 'cleared) + 'ledger-font-posting-amount-cleared-face) + ((eq state 'pending) + 'ledger-font-posting-amount-pending-face) + (t + 'ledger-font-posting-amount-face))) + (when end-of-line-comment + (setq start (point)) + (end-of-line) + (ledger-fontify-set-face (list (- start 1) (point)) ;; subtract 1 from start because we passed the semi-colon + 'ledger-font-comment-face)))))) + +(defun ledger-fontify-directive-at (pos) + "Fontify the directive at POS." + (let ((extents (ledger-navigate-find-element-extents pos)) + (face 'ledger-font-default-face)) + (cond ((looking-at "=") + (setq face 'ledger-font-auto-xact-face)) + ((looking-at "~") + (setq face 'ledger-font-periodic-xact-face)) + ((looking-at "[;#%|\\*]") + (setq face 'ledger-font-comment-face)) + ((looking-at "\\(year\\)\\|Y") + (setq face 'ledger-font-year-directive-face)) + ((looking-at "account") + (setq face 'ledger-font-account-directive-face)) + ((looking-at "apply") + (setq face 'ledger-font-apply-directive-face)) + ((looking-at "alias") + (setq face 'ledger-font-alias-directive-face)) + ((looking-at "assert") + (setq face 'ledger-font-assert-directive-face)) + ((looking-at "\\(bucket\\)\\|A") + (setq face 'ledger-font-bucket-directive-face)) + ((looking-at "capture") + (setq face 'ledger-font-capture-directive-face)) + ((looking-at "check") + (setq face 'ledger-font-check-directive-face)) + ((looking-at "commodity") + (setq face 'ledger-font-commodity-directive-face)) + ((looking-at "define") + (setq face 'ledger-font-define-directive-face)) + ((looking-at "end") + (setq face 'ledger-font-end-directive-face)) + ((looking-at "expr") + (setq face 'ledger-font-expr-directive-face)) + ((looking-at "fixed") + (setq face 'ledger-font-fixed-directive-face)) + ((looking-at "include") + (setq face 'ledger-font-include-directive-face)) + ((looking-at "payee") + (setq face 'ledger-font-payee-directive-face)) + ((looking-at "P") + (setq face 'ledger-font-price-directive-face)) + ((looking-at "tag") + (setq face 'ledger-font-tag-directive-face))) + (ledger-fontify-set-face extents face))) + +(defun ledger-fontify-set-face (extents face) + "Set the text in EXTENTS to FACE." + (put-text-property (car extents) (cadr extents) 'face face)) + + +(provide 'ledger-fontify) + +;;; ledger-fontify.el ends here diff --git a/lisp/ledger-fonts.el b/lisp/ledger-fonts.el index 28f1f98d..8bdecdb3 100644 --- a/lisp/ledger-fonts.el +++ b/lisp/ledger-fonts.el @@ -1,6 +1,6 @@ ;;; ledger-fonts.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. @@ -29,108 +29,246 @@ (require 'ledger-regex) (defgroup ledger-faces nil "Ledger mode highlighting" :group 'ledger) + +(defface ledger-font-default-face + `((t :inherit default)) + "Default face" + :group 'ledger-faces) + +(defface ledger-font-auto-xact-face + `((t :foreground "orange" :weight normal)) + "Default face for automatic transactions" + :group 'ledger-faces) + +(defface ledger-font-periodic-xact-face + `((t :foreground "green" :weight normal)) + "Default face for automatic transactions" + :group 'ledger-faces) + +(defface ledger-font-xact-cleared-face + `((t :foreground "#AAAAAA" :weight normal)) + "Default face for cleared transaction" + :group 'ledger-faces) + +(defface ledger-font-xact-pending-face + `((t :foreground "#444444" :weight normal)) + "Default face for pending transaction" + :group 'ledger-faces) + +(defface ledger-font-xact-open-face + `((t :foreground "#000000" :weight normal)) + "Default face for transaction under point" + :group 'ledger-faces) + (defface ledger-font-payee-uncleared-face - `((t :foreground "#dc322f" :weight bold )) + `((t :foreground "#dc322f" :weight bold )) "Default face for Ledger" :group 'ledger-faces) (defface ledger-font-payee-cleared-face - `((t :foreground "#657b83" :weight normal )) - "Default face for cleared (*) transactions" + `((t :inherit ledger-font-other-face)) + "Default face for cleared (*) payees" + :group 'ledger-faces) + +(defface ledger-font-payee-pending-face + `((t :foreground "#F24B61" :weight normal)) + "Default face for pending (!) payees" :group 'ledger-faces) (defface ledger-font-xact-highlight-face - `((t :background "#eee8d5")) + `((t :inherit ledger-occur-xact-face)) "Default face for transaction under point" :group 'ledger-faces) (defface ledger-font-pending-face - `((t :foreground "#cb4b16" :weight normal )) + `((t :foreground "#cb4b16" :weight normal )) "Default face for pending (!) transactions" :group 'ledger-faces) (defface ledger-font-other-face - `((t :foreground "#657b83" )) + `((t :foreground "#657b83" :weight normal)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-directive-face + `((t :inherit font-lock-preprocessor-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-account-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-price-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-apply-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-alias-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-assert-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-bucket-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-capture-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-check-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-commodity-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-define-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-end-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-expr-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-fixed-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-include-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-payee-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-tag-directive-face + `((t :inherit ledger-font-directive-face)) + "Default face for other transactions" + :group 'ledger-faces) + +(defface ledger-font-year-directive-face + `((t :inherit ledger-font-directive-face)) "Default face for other transactions" :group 'ledger-faces) (defface ledger-font-posting-account-face - `((t :foreground "#268bd2" )) + `((t :foreground "#268bd2" )) "Face for Ledger accounts" :group 'ledger-faces) (defface ledger-font-posting-account-cleared-face - `((t :foreground "#657b83" )) + `((t :inherit ledger-font-other-face)) + "Face for Ledger accounts" + :group 'ledger-faces) + +(defface ledger-font-posting-amount-cleared-face + `((t :inherit ledger-font-posting-account-cleared-face)) "Face for Ledger accounts" :group 'ledger-faces) (defface ledger-font-posting-account-pending-face - `((t :foreground "#cb4b16" )) + `((t :inherit ledger-font-pending-face)) + "Face for Ledger accounts" + :group 'ledger-faces) + +(defface ledger-font-posting-amount-pending-face + `((t :inherit ledger-font-posting-account-pending-face)) "Face for Ledger accounts" :group 'ledger-faces) (defface ledger-font-posting-amount-face - `((t :foreground "#cb4b16" )) + `((t :foreground "#cb4b16" )) "Face for Ledger amounts" :group 'ledger-faces) +(defface ledger-font-posting-date-face + `((t :foreground "#cb4b16" )) + "Face for Ledger dates" + :group 'ledger-faces) + (defface ledger-occur-narrowed-face - `((t :foreground "grey70" :invisible t )) + `((t :inherit font-lock-comment-face :invisible t)) "Default face for Ledger occur mode hidden transactions" :group 'ledger-faces) (defface ledger-occur-xact-face - `((t :background "#eee8d5" )) + `((t :inherit highlight)) "Default face for Ledger occur mode shown transactions" :group 'ledger-faces) (defface ledger-font-comment-face - `((t :foreground "#93a1a1" :slant italic)) + `((t :inherit font-lock-comment-face)) "Face for Ledger comments" :group 'ledger-faces) (defface ledger-font-reconciler-uncleared-face - `((t :foreground "#dc322f" :weight bold )) + `((t :inherit ledger-font-payee-uncleared-face)) "Default face for uncleared transactions in the reconcile window" :group 'ledger-faces) (defface ledger-font-reconciler-cleared-face - `((t :foreground "#657b83" :weight normal )) + `((t :inherit ledger-font-other-face)) "Default face for cleared (*) transactions in the reconcile window" :group 'ledger-faces) (defface ledger-font-reconciler-pending-face - `((t :foreground "#cb4b16" :weight normal )) + `((t :inherit ledger-font-pending-face)) "Default face for pending (!) transactions in the reconcile window" :group 'ledger-faces) (defface ledger-font-report-clickable-face - `((t :foreground "#cb4b16" :weight normal )) + `((t :foreground "#cb4b16" :weight normal )) "Default face for pending (!) transactions in the reconcile window" :group 'ledger-faces) + (defvar ledger-font-lock-keywords + `(("account" . ledger-font-account-directive-face) + ("apply" . ledger-font-apply-directive-face) + ("alias" . ledger-font-alias-directive-face) + ("assert" . ledger-font-assert-directive-face) + ("bucket" . ledger-font-bucket-directive-face) + ("capture" . ledger-font-capture-directive-face) + ("check" . ledger-font-check-directive-face) + ("commodity" . ledger-font-commodity-directive-face) + ("define" . ledger-font-define-directive-face) + ("end" . ledger-font-end-directive-face) + ("expr" . ledger-font-expr-directive-face) + ("fixed" . ledger-font-fixed-directive-face) + ("include" . ledger-font-include-directive-face) + ("payee" . ledger-font-payee-directive-face) + ("tag" . ledger-font-tag-directive-face) + ("year" . ledger-font-year-directive-face)) + "Expressions to highlight in Ledger mode.") -(defvar ledger-font-lock-keywords - `( ;; (,ledger-other-entries-regex 1 - ;; ledger-font-other-face) - (,ledger-comment-regex 0 - 'ledger-font-comment-face) - (,ledger-multiline-comment-regex 0 'ledger-font-comment-face) - (,ledger-payee-pending-regex 2 - 'ledger-font-payee-pending-face) ; Works - (,ledger-payee-cleared-regex 2 - 'ledger-font-payee-cleared-face) ; Works - (,ledger-payee-uncleared-regex 2 - 'ledger-font-payee-uncleared-face) ; Works - (,ledger-account-cleared-regex 2 - 'ledger-font-posting-account-cleared-face) ; Works - (,ledger-account-pending-regex 2 - 'ledger-font-posting-account-pending-face) ; Works - (,ledger-account-any-status-regex 2 - 'ledger-font-posting-account-face) ; Works - (,ledger-other-entries-regex 1 - 'ledger-font-other-face)) - "Expressions to highlight in Ledger mode.") (provide 'ledger-fonts) diff --git a/lisp/ledger-init.el b/lisp/ledger-init.el index fd06d4c5..49d74098 100644 --- a/lisp/ledger-init.el +++ b/lisp/ledger-init.el @@ -1,6 +1,6 @@ ;;; ledger-init.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,52 +16,59 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. ;;; Commentary: ;; Determine the ledger environment (require 'ledger-regex) +;;; Code: + (defcustom ledger-init-file-name "~/.ledgerrc" - "Location of the ledger initialization file. nil if you don't have one" + "Location of the ledger initialization file. nil if you don't have one." :group 'ledger-exec) (defvar ledger-environment-alist nil) +(defvar ledger-default-date-format "%Y/%m/%d") + (defun ledger-init-parse-initialization (buffer) + "Parse the .ledgerrc file in BUFFER." (with-current-buffer buffer (let (environment-alist) (goto-char (point-min)) (while (re-search-forward ledger-init-string-regex nil t ) - (let ((matchb (match-beginning 0)) ;; save the match data, string-match stamp on it - (matche (match-end 0))) - (end-of-line) - (setq environment-alist - (append environment-alist - (list (cons (let ((flag (buffer-substring-no-properties (+ 2 matchb) matche))) - (if (string-match "[ \t\n\r]+\\'" flag) - (replace-match "" t t flag) - flag)) - (let ((value (buffer-substring-no-properties matche (point) ))) - (if (> (length value) 0) - value - t)))))))) + (let ((matchb (match-beginning 0)) ;; save the match data, string-match stamp on it + (matche (match-end 0))) + (end-of-line) + (setq environment-alist + (append environment-alist + (list (cons (let ((flag (buffer-substring-no-properties (+ 2 matchb) matche))) + (if (string-match "[ \t\n\r]+\\'" flag) + (replace-match "" t t flag) + flag)) + (let ((value (buffer-substring-no-properties matche (point) ))) + (if (> (length value) 0) + value + t)))))))) environment-alist))) (defun ledger-init-load-init-file () + "Load and parse the .ledgerrc file." (interactive) (let ((init-base-name (file-name-nondirectory ledger-init-file-name))) (if (get-buffer init-base-name) ;; init file already loaded, parse it and leave it - (ledger-init-parse-initialization init-base-name) - (when (and ledger-init-file-name - (file-exists-p ledger-init-file-name) - (file-readable-p ledger-init-file-name)) - (find-file-noselect ledger-init-file-name) - (setq ledger-environment-alist - (ledger-init-parse-initialization init-base-name)) - (kill-buffer init-base-name))))) + (setq ledger-environment-alist + (ledger-init-parse-initialization init-base-name)) + (when (and ledger-init-file-name + (file-exists-p ledger-init-file-name) + (file-readable-p ledger-init-file-name)) + (find-file-noselect ledger-init-file-name) + (setq ledger-environment-alist + (ledger-init-parse-initialization init-base-name)) + (kill-buffer init-base-name))))) (provide 'ledger-init) diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el index b604581c..4e2beff6 100644 --- a/lisp/ledger-mode.el +++ b/lisp/ledger-mode.el @@ -1,6 +1,6 @@ ;;; ledger-mode.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. @@ -27,14 +27,18 @@ ;;; Code: (require 'ledger-regex) +(require 'cus-edit) (require 'esh-util) (require 'esh-arg) +(require 'easymenu) (require 'ledger-commodities) (require 'ledger-complete) (require 'ledger-context) (require 'ledger-exec) (require 'ledger-fonts) +(require 'ledger-fontify) (require 'ledger-init) +(require 'ledger-navigate) (require 'ledger-occur) (require 'ledger-post) (require 'ledger-reconcile) @@ -58,29 +62,32 @@ (defconst ledger-mode-version "3.0.0") (defun ledger-mode-dump-variable (var) - (if var - (insert (format " %s: %S\n" (symbol-name var) (eval var))))) + "Format VAR for dump to buffer." + (if var + (insert (format " %s: %S\n" (symbol-name var) (eval var))))) (defun ledger-mode-dump-group (group) - "Dump GROUP customizations to current buffer" + "Dump GROUP customizations to current buffer." (let ((members (custom-group-members group nil))) (dolist (member members) (cond ((eq (cadr member) 'custom-group) - (insert (format "Group %s:\n" (symbol-name (car member)))) - (ledger-mode-dump-group (car member))) - ((eq (cadr member) 'custom-variable) - (ledger-mode-dump-variable (car member))))))) + (insert (format "Group %s:\n" (symbol-name (car member)))) + (ledger-mode-dump-group (car member))) + ((eq (cadr member) 'custom-variable) + (ledger-mode-dump-variable (car member))))))) (defun ledger-mode-dump-configuration () - "Dump all customizations" + "Dump all customizations." + (interactive) (find-file "ledger-mode-dump") (ledger-mode-dump-group 'ledger)) -(defsubst ledger-current-year () +(defun ledger-current-year () "The default current year for adding transactions." (format-time-string "%Y")) -(defsubst ledger-current-month () + +(defun ledger-current-month () "The default current month for adding transactions." (format-time-string "%m")) @@ -91,32 +98,44 @@ "Start a ledger session with the current month, but make it customizable to ease retro-entry.") (defun ledger-read-account-with-prompt (prompt) - (let* ((context (ledger-context-at-point)) - (default (if (and (eq (ledger-context-line-type context) 'acct-transaction) - (eq (ledger-context-current-field context) 'account)) - (regexp-quote (ledger-context-field-value context 'account)) - nil))) - (ledger-read-string-with-default prompt default))) + "Read an account from the minibuffer with PROMPT." + (let ((context (ledger-context-at-point))) + (ledger-read-string-with-default prompt + (if (eq (ledger-context-current-field context) 'account) + (regexp-quote (ledger-context-field-value context 'account)) + nil)))) + +(defun ledger-read-date (prompt) + "Return user-supplied date after `PROMPT', defaults to today." + (let* ((default (ledger-year-and-month)) + (date (read-string prompt default + 'ledger-minibuffer-history))) + (if (or (string= date default) + (string= "" date)) + (format-time-string + (or (cdr (assoc "date-format" ledger-environment-alist)) + ledger-default-date-format)) + date))) (defun ledger-read-string-with-default (prompt default) "Return user supplied string after PROMPT, or DEFAULT." (read-string (concat prompt - (if default - (concat " (" default "): ") - ": ")) - nil 'ledger-minibuffer-history default)) + (if default + (concat " (" default "): ") + ": ")) + nil 'ledger-minibuffer-history default)) (defun ledger-display-balance-at-point () "Display the cleared-or-pending balance. And calculate the target-delta of the account being reconciled." (interactive) (let* ((account (ledger-read-account-with-prompt "Account balance to show")) - (buffer (current-buffer)) - (balance (with-temp-buffer - (ledger-exec-ledger buffer (current-buffer) "cleared" account) - (if (> (buffer-size) 0) - (buffer-substring-no-properties (point-min) (1- (point-max))) - (concat account " is empty."))))) + (buffer (current-buffer)) + (balance (with-temp-buffer + (ledger-exec-ledger buffer (current-buffer) "cleared" account) + (if (> (buffer-size) 0) + (buffer-substring-no-properties (point-min) (1- (point-max))) + (concat account " is empty."))))) (when balance (message balance)))) @@ -125,171 +144,229 @@ And calculate the target-delta of the account being reconciled." And calculate the target-delta of the account being reconciled." (interactive) (let* ((buffer (current-buffer)) - (balance (with-temp-buffer - (ledger-exec-ledger buffer (current-buffer) "stats") - (buffer-substring-no-properties (point-min) (1- (point-max)))))) + (balance (with-temp-buffer + (ledger-exec-ledger buffer (current-buffer) "stats") + (buffer-substring-no-properties (point-min) (1- (point-max)))))) (when balance (message balance)))) (defun ledger-magic-tab (&optional interactively) - "Decide what to with with <TAB>. + "Decide what to with with <TAB>, INTERACTIVELY. Can indent, complete or align depending on context." (interactive "p") - (if (= (point) (line-beginning-position)) - (indent-to ledger-post-account-alignment-column) - (if (and (> (point) 1) - (looking-back "\\([^ \t]\\)" 1)) - (ledger-pcomplete interactively) - (ledger-post-align-postings)))) + (if (= (point) (line-beginning-position)) + (indent-to ledger-post-account-alignment-column) + (if (and (> (point) 1) + (looking-back "\\([^ \t]\\)" 1)) + (ledger-pcomplete interactively) + (ledger-post-align-postings)))) (defvar ledger-mode-abbrev-table) -(defun ledger-insert-effective-date () +(defvar ledger-date-string-today + (format-time-string (or + (cdr (assoc "date-format" ledger-environment-alist)) + ledger-default-date-format))) + +(defun ledger-remove-effective-date () + "Remove the effective date from a transaction or posting." (interactive) - (let ((context (car (ledger-context-at-point))) - (date-string (format-time-string (cdr (assoc "date-format" ledger-environment-alist))))) - (cond ((eq 'xact context) - (beginning-of-line) - (insert date-string "=")) - ((eq 'acct-transaction context) - (end-of-line) - (insert " ; [=" date-string "]"))))) + (let ((context (car (ledger-context-at-point)))) + (save-excursion + (save-restriction + (narrow-to-region (point-at-bol) (point-at-eol)) + (beginning-of-line) + (cond ((eq 'xact context) + (re-search-forward ledger-iso-date-regexp) + (when (= (char-after) ?=) + (let ((eq-pos (point))) + (delete-region + eq-pos + (re-search-forward ledger-iso-date-regexp))))) + ((eq 'acct-transaction context) + ;; Match "; [=date]" & delete string + (when (re-search-forward + (concat ledger-comment-regex + "\\[=" ledger-iso-date-regexp "\\]") + nil 'noerr) + (replace-match "")))))))) + +(defun ledger-insert-effective-date (&optional date) + "Insert effective date `DATE' to the transaction or posting. + +If `DATE' is nil, prompt the user a date. + +Replace the current effective date if there's one in the same +line. + +With a prefix argument, remove the effective date." + (interactive) + (if (and (listp current-prefix-arg) + (= 4 (prefix-numeric-value current-prefix-arg))) + (ledger-remove-effective-date) + (let* ((context (car (ledger-context-at-point))) + (date-string (or date (ledger-read-date "Effective date: ")))) + (save-restriction + (narrow-to-region (point-at-bol) (point-at-eol)) + (cond + ((eq 'xact context) + (beginning-of-line) + (re-search-forward ledger-iso-date-regexp) + (when (= (char-after) ?=) + (ledger-remove-effective-date)) + (insert "=" date-string)) + ((eq 'acct-transaction context) + (end-of-line) + (ledger-remove-effective-date) + (insert " ; [=" date-string "]"))))))) (defun ledger-mode-remove-extra-lines () + "Get rid of multiple empty lines." (goto-char (point-min)) - (while (re-search-forward "\n\n\\(\n\\)+" nil t) - (replace-match "\n\n"))) + (while (re-search-forward "\n\n\\(\n\\)+" nil t) + (replace-match "\n\n"))) (defun ledger-mode-clean-buffer () - "indent, remove multiple linfe feeds and sort the buffer" - (interactive) - (ledger-sort-buffer) - (ledger-post-align-postings (point-min) (point-max)) - (ledger-mode-remove-extra-lines)) - + "Indent, remove multiple line feeds and sort the buffer." + (interactive) + (let ((start (point-min-marker)) + (end (point-max-marker))) + (goto-char start) + (ledger-navigate-beginning-of-xact) + (beginning-of-line) + (let ((target (buffer-substring (point) (progn + (end-of-line) + (point))))) + (untabify start end) + (ledger-sort-buffer) + (ledger-post-align-postings start end) + (ledger-mode-remove-extra-lines) + (goto-char start) + (search-forward target)))) + +(defvar ledger-mode-syntax-table + (let ((table (make-syntax-table text-mode-syntax-table))) + (modify-syntax-entry ?\; "<" table) + (modify-syntax-entry ?\n ">" table) + table) + "Syntax table in use in `ledger-mode' buffers.") + +(defvar ledger-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [(control ?c) (control ?a)] 'ledger-add-transaction) + (define-key map [(control ?c) (control ?b)] 'ledger-post-edit-amount) + (define-key map [(control ?c) (control ?c)] 'ledger-toggle-current) + (define-key map [(control ?c) (control ?d)] 'ledger-delete-current-transaction) + (define-key map [(control ?c) (control ?e)] 'ledger-toggle-current-transaction) + (define-key map [(control ?c) (control ?f)] 'ledger-occur) + (define-key map [(control ?c) (control ?k)] 'ledger-copy-transaction-at-point) + (define-key map [(control ?c) (control ?m)] 'ledger-set-month) + (define-key map [(control ?c) (control ?r)] 'ledger-reconcile) + (define-key map [(control ?c) (control ?s)] 'ledger-sort-region) + (define-key map [(control ?c) (control ?t)] 'ledger-insert-effective-date) + (define-key map [(control ?c) (control ?u)] 'ledger-schedule-upcoming) + (define-key map [(control ?c) (control ?y)] 'ledger-set-year) + (define-key map [(control ?c) (control ?p)] 'ledger-display-balance-at-point) + (define-key map [(control ?c) (control ?l)] 'ledger-display-ledger-stats) + (define-key map [(control ?c) (control ?q)] 'ledger-post-align-xact) + + (define-key map [tab] 'ledger-magic-tab) + (define-key map [(control tab)] 'ledger-post-align-xact) + (define-key map [(control ?i)] 'ledger-magic-tab) + (define-key map [(control ?c) tab] 'ledger-fully-complete-xact) + (define-key map [(control ?c) (control ?i)] 'ledger-fully-complete-xact) + + (define-key map [(control ?c) (control ?o) (control ?a)] 'ledger-report-redo) + (define-key map [(control ?c) (control ?o) (control ?e)] 'ledger-report-edit) + (define-key map [(control ?c) (control ?o) (control ?g)] 'ledger-report-goto) + (define-key map [(control ?c) (control ?o) (control ?k)] 'ledger-report-kill) + (define-key map [(control ?c) (control ?o) (control ?r)] 'ledger-report) + (define-key map [(control ?c) (control ?o) (control ?s)] 'ledger-report-save) + + (define-key map [(meta ?p)] 'ledger-navigate-prev-xact-or-directive) + (define-key map [(meta ?n)] 'ledger-navigate-next-xact-or-directive) + map) + "Keymap for `ledger-mode'.") + +(easy-menu-define ledger-mode-menu ledger-mode-map + "Ledger menu" + '("Ledger" + ["Narrow to REGEX" ledger-occur] + ["Show all transactions" ledger-occur-mode ledger-occur-mode] + ["Ledger Statistics" ledger-display-ledger-stats ledger-works] + "---" + ["Show upcoming transactions" ledger-schedule-upcoming] + ["Add Transaction (ledger xact)" ledger-add-transaction ledger-works] + ["Complete Transaction" ledger-fully-complete-xact] + ["Delete Transaction" ledger-delete-current-transaction] + "---" + ["Calc on Amount" ledger-post-edit-amount] + "---" + ["Check Balance" ledger-display-balance-at-point ledger-works] + ["Reconcile Account" ledger-reconcile ledger-works] + "---" + ["Toggle Current Transaction" ledger-toggle-current-transaction] + ["Toggle Current Posting" ledger-toggle-current] + ["Copy Trans at Point" ledger-copy-transaction-at-point] + "---" + ["Clean-up Buffer" ledger-mode-clean-buffer] + ["Align Region" ledger-post-align-postings mark-active] + ["Align Xact" ledger-post-align-xact] + ["Sort Region" ledger-sort-region mark-active] + ["Sort Buffer" ledger-sort-buffer] + ["Mark Sort Beginning" ledger-sort-insert-start-mark] + ["Mark Sort End" ledger-sort-insert-end-mark] + ["Set effective date" ledger-insert-effective-date] + "---" + ["Customize Ledger Mode" (lambda () (interactive) (customize-group 'ledger))] + ["Set Year" ledger-set-year ledger-works] + ["Set Month" ledger-set-month ledger-works] + "---" + ["Run Report" ledger-report ledger-works] + ["Goto Report" ledger-report-goto ledger-works] + ["Re-run Report" ledger-report-redo ledger-works] + ["Save Report" ledger-report-save ledger-works] + ["Edit Report" ledger-report-edit ledger-works] + ["Kill Report" ledger-report-kill ledger-works])) ;;;###autoload (define-derived-mode ledger-mode text-mode "Ledger" - "A mode for editing ledger data files." - (ledger-check-version) - (ledger-post-setup) - - (set (make-local-variable 'comment-start) "; ") - (set (make-local-variable 'comment-end) "") - (set (make-local-variable 'indent-tabs-mode) nil) - - (if (boundp 'font-lock-defaults) - (set (make-local-variable 'font-lock-defaults) - '(ledger-font-lock-keywords nil t))) - (setq font-lock-extend-region-functions - (list #'font-lock-extend-region-wholelines)) - (setq font-lock-multiline nil) - - (set (make-local-variable 'pcomplete-parse-arguments-function) - 'ledger-parse-arguments) - (set (make-local-variable 'pcomplete-command-completion-function) - 'ledger-complete-at-point) - (set (make-local-variable 'pcomplete-termination-string) "") - - (add-hook 'post-command-hook 'ledger-highlight-xact-under-point nil t) - (add-hook 'before-revert-hook 'ledger-occur-remove-all-overlays nil t) - (make-variable-buffer-local 'highlight-overlay) - - (ledger-init-load-init-file) - - (set (make-local-variable 'indent-region-function) 'ledger-post-align-postings) - - (let ((map (current-local-map))) - (define-key map [(control ?c) (control ?a)] 'ledger-add-transaction) - (define-key map [(control ?c) (control ?b)] 'ledger-post-edit-amount) - (define-key map [(control ?c) (control ?c)] 'ledger-toggle-current) - (define-key map [(control ?c) (control ?d)] 'ledger-delete-current-transaction) - (define-key map [(control ?c) (control ?e)] 'ledger-toggle-current-transaction) - (define-key map [(control ?c) (control ?f)] 'ledger-occur) - (define-key map [(control ?c) (control ?k)] 'ledger-copy-transaction-at-point) - (define-key map [(control ?c) (control ?m)] 'ledger-set-month) - (define-key map [(control ?c) (control ?r)] 'ledger-reconcile) - (define-key map [(control ?c) (control ?s)] 'ledger-sort-region) - (define-key map [(control ?c) (control ?t)] 'ledger-insert-effective-date) - (define-key map [(control ?c) (control ?u)] 'ledger-schedule-upcoming) - (define-key map [(control ?c) (control ?y)] 'ledger-set-year) - (define-key map [(control ?c) (control ?p)] 'ledger-display-balance-at-point) - (define-key map [(control ?c) (control ?l)] 'ledger-display-ledger-stats) - (define-key map [(control ?c) (control ?q)] 'ledger-post-align-xact) - - (define-key map [tab] 'ledger-magic-tab) - (define-key map [(control tab)] 'ledger-post-align-xact) - (define-key map [(control ?i)] 'ledger-magic-tab) - (define-key map [(control ?c) tab] 'ledger-fully-complete-xact) - (define-key map [(control ?c) (control ?i)] 'ledger-fully-complete-xact) - - (define-key map [(control ?c) (control ?o) (control ?a)] 'ledger-report-redo) - (define-key map [(control ?c) (control ?o) (control ?e)] 'ledger-report-edit) - (define-key map [(control ?c) (control ?o) (control ?g)] 'ledger-report-goto) - (define-key map [(control ?c) (control ?o) (control ?k)] 'ledger-report-kill) - (define-key map [(control ?c) (control ?o) (control ?r)] 'ledger-report) - (define-key map [(control ?c) (control ?o) (control ?s)] 'ledger-report-save) - - (define-key map [(meta ?p)] 'ledger-post-prev-xact) - (define-key map [(meta ?n)] 'ledger-post-next-xact) - - (define-key map [menu-bar] (make-sparse-keymap "ledger-menu")) - (define-key map [menu-bar ledger-menu] (cons "Ledger" map)) - - (define-key map [report-kill] '(menu-item "Kill Report" ledger-report-kill :enable ledger-works)) - (define-key map [report-edit] '(menu-item "Edit Report" ledger-report-edit :enable ledger-works)) - (define-key map [report-save] '(menu-item "Save Report" ledger-report-save :enable ledger-works)) - (define-key map [report-rrun] '(menu-item "Re-run Report" ledger-report-redo :enable ledger-works)) - (define-key map [report-goto] '(menu-item "Goto Report" ledger-report-goto :enable ledger-works)) - (define-key map [report-run] '(menu-item "Run Report" ledger-report :enable ledger-works)) - (define-key map [sep5] '(menu-item "--")) - (define-key map [set-month] '(menu-item "Set Month" ledger-set-month :enable ledger-works)) - (define-key map [set-year] '(menu-item "Set Year" ledger-set-year :enable ledger-works)) - (define-key map [cust] '(menu-item "Customize Ledger Mode" (lambda () - (interactive) - (customize-group 'ledger)))) - (define-key map [sep1] '("--")) - (define-key map [effective-date] '(menu-item "Set effective date" ledger-insert-effective-date)) - (define-key map [sort-end] '(menu-item "Mark Sort End" ledger-sort-insert-end-mark)) - (define-key map [sort-start] '(menu-item "Mark Sort Beginning" ledger-sort-insert-start-mark)) - (define-key map [sort-buff] '(menu-item "Sort Buffer" ledger-sort-buffer)) - (define-key map [sort-reg] '(menu-item "Sort Region" ledger-sort-region :enable mark-active)) - (define-key map [align-xact] '(menu-item "Align Xact" ledger-post-align-xact)) - (define-key map [align-reg] '(menu-item "Align Region" ledger-post-align-postings :enable mark-active)) - (define-key map [clean-buf] '(menu-item "Clean-up Buffer" ledger-mode-clean-buffer)) - (define-key map [sep2] '(menu-item "--")) - (define-key map [copy-xact] '(menu-item "Copy Trans at Point" ledger-copy-transaction-at-point)) - (define-key map [toggle-post] '(menu-item "Toggle Current Posting" ledger-toggle-current)) - (define-key map [toggle-xact] '(menu-item "Toggle Current Transaction" ledger-toggle-current-transaction)) - (define-key map [sep4] '(menu-item "--")) - (define-key map [recon-account] '(menu-item "Reconcile Account" ledger-reconcile :enable ledger-works)) - (define-key map [check-balance] '(menu-item "Check Balance" ledger-display-balance-at-point :enable ledger-works)) - (define-key map [sep6] '(menu-item "--")) - (define-key map [edit-amount] '(menu-item "Calc on Amount" ledger-post-edit-amount)) - (define-key map [sep] '(menu-item "--")) - (define-key map [delete-xact] '(menu-item "Delete Transaction" ledger-delete-current-transaction)) - (define-key map [cmp-xact] '(menu-item "Complete Transaction" ledger-fully-complete-xact)) - (define-key map [add-xact] '(menu-item "Add Transaction (ledger xact)" ledger-add-transaction :enable ledger-works)) - (define-key map [sep3] '(menu-item "--")) - (define-key map [stats] '(menu-item "Ledger Statistics" ledger-display-ledger-stats :enable ledger-works)) - (define-key map [fold-buffer] '(menu-item "Narrow to REGEX" ledger-occur)))) + "A mode for editing ledger data files." + (ledger-check-version) + (when (boundp 'font-lock-defaults) + (setq font-lock-defaults + '(ledger-font-lock-keywords t t nil nil + (font-lock-fontify-region-function . ledger-fontify-buffer-part)))) + + (set (make-local-variable 'pcomplete-parse-arguments-function) 'ledger-parse-arguments) + (set (make-local-variable 'pcomplete-command-completion-function) 'ledger-complete-at-point) + (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t) + (add-hook 'after-save-hook 'ledger-report-redo) + + (add-hook 'post-command-hook 'ledger-highlight-xact-under-point nil t) + + (ledger-init-load-init-file) + (setq comment-start ";") + (set (make-local-variable 'indent-region-function) 'ledger-post-align-postings)) (defun ledger-set-year (newyear) "Set ledger's idea of the current year to the prefix argument NEWYEAR." (interactive "p") - (if (= newyear 1) - (setq ledger-year (read-string "Year: " (ledger-current-year))) - (setq ledger-year (number-to-string newyear)))) + (setq ledger-year + (if (= newyear 1) + (read-string "Year: " (ledger-current-year)) + (number-to-string newyear)))) (defun ledger-set-month (newmonth) "Set ledger's idea of the current month to the prefix argument NEWMONTH." (interactive "p") - (if (= newmonth 1) - (setq ledger-month (read-string "Month: " (ledger-current-month))) - (setq ledger-month (format "%02d" newmonth)))) + (setq ledger-month + (if (= newmonth 1) + (read-string "Month: " (ledger-current-month)) + (format "%02d" newmonth)))) diff --git a/lisp/ledger-navigate.el b/lisp/ledger-navigate.el new file mode 100644 index 00000000..904faf8c --- /dev/null +++ b/lisp/ledger-navigate.el @@ -0,0 +1,168 @@ +;;; ledger-navigate.el --- Provide navigation services through the ledger buffer. + +;; Copyright (C) 2014-2015 Craig Earls (enderw88 AT gmail DOT com) + +;; This file is not part of GNU Emacs. + +;; This is free software; you can redistribute it and/or modify it under +;; the terms of the GNU General Public License as published by the Free +;; Software Foundation; either version 2, or (at your option) any later +;; version. +;; +;; This is distributed in the hope that it will be useful, but WITHOUT +;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +;; for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. + + +;;; Commentary: +;; + +;;; Code: + +(require 'ledger-regex) +(require 'ledger-context) + +(defun ledger-navigate-next-xact () + "Move point to beginning of next xact." + ;; make sure we actually move to the next xact, even if we are the + ;; beginning of one now. + (if (looking-at ledger-payee-any-status-regex) + (forward-line)) + (if (re-search-forward ledger-payee-any-status-regex nil t) + (goto-char (match-beginning 0)) + (goto-char (point-max)))) + +(defun ledger-navigate-start-xact-or-directive-p () + "Return t if at the beginning of an empty or all-whitespace line." + (not (looking-at "[ \t]\\|\\(^$\\)"))) + +(defun ledger-navigate-next-xact-or-directive () + "Move to the beginning of the next xact or directive." + (interactive) + (beginning-of-line) + (if (ledger-navigate-start-xact-or-directive-p) ; if we are the start of an xact, move forward to the next xact + (progn + (forward-line) + (if (not (ledger-navigate-start-xact-or-directive-p)) ; we have moved forward and are not at another xact, recurse forward + (ledger-navigate-next-xact-or-directive))) + (while (not (or (eobp) ; we didn't start off at the beginning of an xact + (ledger-navigate-start-xact-or-directive-p))) + (forward-line)))) + +(defun ledger-navigate-prev-xact-or-directive () + "Move point to beginning of previous xact." + (interactive) + (let ((context (car (ledger-context-at-point)))) + (when (equal context 'acct-transaction) + (ledger-navigate-beginning-of-xact)) + (beginning-of-line) + (re-search-backward "^[[:graph:]]" nil t))) + +(defun ledger-navigate-beginning-of-xact () + "Move point to the beginning of the current xact." + (interactive) + ;; need to start at the beginning of a line incase we are in the first line of an xact already. + (beginning-of-line) + (let ((sreg (concat "^\\(=\\|~\\|" ledger-iso-date-regexp "\\)"))) + (unless (looking-at sreg) + (re-search-backward sreg nil t) + (beginning-of-line))) + (point)) + +(defun ledger-navigate-end-of-xact () + "Move point to end of xact." + (interactive) + (ledger-navigate-next-xact-or-directive) + (re-search-backward ".$") + (end-of-line) + (point)) + +(defun ledger-navigate-to-line (line-number) + "Rapidly move point to line LINE-NUMBER." + (goto-char (point-min)) + (forward-line (1- line-number))) + +(defun ledger-navigate-find-xact-extents (pos) + "Return list containing point for beginning and end of xact containing POS. +Requires empty line separating xacts." + (interactive "d") + (save-excursion + (goto-char pos) + (list (ledger-navigate-beginning-of-xact) + (ledger-navigate-end-of-xact)))) + +(defun ledger-navigate-find-directive-extents (pos) + "Return the extents of the directive at POS." + (goto-char pos) + (let ((begin (progn (beginning-of-line) + (point))) + (end (progn (end-of-line) + (+ 1 (point))))) + ;; handle block comments here + (beginning-of-line) + (if (looking-at " *;") + (progn + (while (and (looking-at " *;") + (> (point) (point-min))) + (forward-line -1)) + ;; We are either at the beginning of the buffer, or we found + ;; a line outside the comment. If we are not at the + ;; beginning of the buffer then we need to move forward a + ;; line. + (if (> (point) (point-min)) + (progn (forward-line 1) + (beginning-of-line))) + (setq begin (point)) + (goto-char pos) + (beginning-of-line) + (while (and (looking-at " *;") + (< (point) (point-max))) + (forward-line 1)) + (setq end (point)))) + (list begin end))) + +(defun ledger-navigate-block-comment (pos) + "Move past the block comment at POS, and return its extents." + (interactive "d") + (goto-char pos) + (let ((begin (progn (beginning-of-line) + (point))) + (end (progn (end-of-line) + (point)))) + ;; handle block comments here + (beginning-of-line) + (if (looking-at " *;") + (progn + (while (and (looking-at " *;") + (> (point) (point-min))) + (forward-line -1)) + (setq begin (point)) + (goto-char pos) + (beginning-of-line) + (while (and (looking-at " *;") + (< (point) (point-max))) + (forward-line 1)) + (setq end (point)))) + (list begin end))) + + +(defun ledger-navigate-find-element-extents (pos) + "Return list containing beginning and end of the entity surrounding POS." + (interactive "d") + (save-excursion + (goto-char pos) + (beginning-of-line) + (if (looking-at "[ =~0-9]") + (ledger-navigate-find-xact-extents pos) + (ledger-navigate-find-directive-extents pos)))) + + +(provide 'ledger-navigate) + +;;; ledger-navigate.el ends here diff --git a/lisp/ledger-occur.el b/lisp/ledger-occur.el index 33d3a56c..a4fde2e1 100644 --- a/lisp/ledger-occur.el +++ b/lisp/ledger-occur.el @@ -1,6 +1,6 @@ -;;; ledger-mode.el --- Helper code for use with the "ledger" command-line tool +;;; ledger-occur.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. ;;; Commentary: ;; Provide buffer narrowing to ledger mode. Adapted from original loccur @@ -29,6 +29,9 @@ ;;; Code: +(require 'cl) +(require 'ledger-navigate) + (defconst ledger-occur-overlay-property-name 'ledger-occur-custom-buffer-grep) (defcustom ledger-occur-use-face-shown t @@ -38,154 +41,127 @@ (make-variable-buffer-local 'ledger-occur-use-face-shown) -(defvar ledger-occur-mode nil - "name of the minor mode, shown in the mode-line") +(defvar ledger-occur-history nil + "History of previously searched expressions for the prompt.") -(make-variable-buffer-local 'ledger-occur-mode) +(defvar ledger-occur-current-regex nil + "Pattern currently applied to narrow the buffer.") +(make-variable-buffer-local 'ledger-occur-current-regex) -(or (assq 'ledger-occur-mode minor-mode-alist) - (nconc minor-mode-alist - (list '(ledger-occur-mode ledger-occur-mode)))) +(defvar ledger-occur-mode-map (make-sparse-keymap)) -(defvar ledger-occur-history nil - "History of previously searched expressions for the prompt.") +(define-minor-mode ledger-occur-mode + "A minor mode which display only transactions matching `ledger-occur-current-regex'." + nil + (:eval (format " Ledger-Narrow(%s)" ledger-occur-current-regex)) + ledger-occur-mode-map + (if (and ledger-occur-current-regex ledger-occur-mode) + (ledger-occur-refresh) + (ledger-occur-remove-overlays) + (message "Showing all transactions"))) -(defvar ledger-occur-last-match nil - "Last match found.") -(make-variable-buffer-local 'ledger-occur-last-match) +(define-key ledger-occur-mode-map (kbd "C-c C-g") 'ledger-occur-refresh) +(define-key ledger-occur-mode-map (kbd "C-c C-f") 'ledger-occur-mode) -(defun ledger-occur-remove-all-overlays () - "Remove all overlays from the ledger buffer." +(defun ledger-occur-refresh () + "Re-apply the current narrowing expression." (interactive) - (remove-overlays)) - -(defun ledger-occur-mode (regex buffer) - "Highlight transactions that match REGEX in BUFFER, hiding others. - -When REGEX is nil, unhide everything, and remove higlight" - (set-buffer buffer) - (setq ledger-occur-mode - (if (or (null regex) - (zerop (length regex))) - nil - (concat " Ledger-Narrowed: " regex))) - (force-mode-line-update) - (ledger-occur-remove-overlays) - (when ledger-occur-mode - (ledger-occur-create-overlays - (ledger-occur-compress-matches - (ledger-occur-find-matches regex))) - (setq ledger-occur-last-match regex) - (if (get-buffer-window buffer) - (select-window (get-buffer-window buffer)))) - (recenter)) + (let ((matches (ledger-occur-compress-matches + (ledger-occur-find-matches ledger-occur-current-regex)))) + (if matches + (ledger-occur-create-overlays matches) + (message "No matches found for '%s'" ledger-occur-current-regex) + (ledger-occur-mode -1)))) (defun ledger-occur (regex) - "Perform a simple grep in current buffer for the regular expression REGEX. + "Show only transactions in the current buffer which match REGEX. - This command hides all xact from the current buffer except - those containing the regular expression REGEX. A second call - of the function unhides lines again" +This command hides all xact in the current buffer except those +matching REGEX. If REGEX is nil or empty, turn off any narrowing +currently active." (interactive - (if ledger-occur-mode - (list nil) - (list (read-string (concat "Regexp<" (ledger-occur-prompt) ">: ") - nil 'ledger-occur-history (ledger-occur-prompt))))) - (ledger-occur-mode regex (current-buffer))) + (list (read-regexp "Regexp" (ledger-occur-prompt) 'ledger-occur-history))) + (if (or (null regex) + (zerop (length regex))) ; empty regex, or already have narrowed, clear narrowing + (ledger-occur-mode -1) + (setq ledger-occur-current-regex regex) + (ledger-occur-mode 1))) (defun ledger-occur-prompt () "Return the default value of the prompt. Default value for prompt is a current word or active region(selection), if its size is 1 line" - (let ((prompt - (if (and transient-mark-mode - mark-active) - (let ((pos1 (region-beginning)) - (pos2 (region-end))) - ;; Check if the start and the of an active region is on - ;; the same line - (if (= (line-number-at-pos pos1) - (line-number-at-pos pos2)) - (buffer-substring-no-properties pos1 pos2))) - (current-word)))) - prompt)) + (if (use-region-p) + (let ((pos1 (region-beginning)) + (pos2 (region-end))) + ;; Check if the start and the of an active region is on + ;; the same line + (if (= (line-number-at-pos pos1) + (line-number-at-pos pos2)) + (buffer-substring-no-properties pos1 pos2))) + (current-word))) (defun ledger-occur-make-visible-overlay (beg end) - (let ((ovl (make-overlay beg end (current-buffer)))) - (overlay-put ovl ledger-occur-overlay-property-name t) - (overlay-put ovl 'face 'ledger-occur-xact-face))) + (let ((ovl (make-overlay beg end (current-buffer)))) + (overlay-put ovl ledger-occur-overlay-property-name t) + (overlay-put ovl 'face 'ledger-occur-xact-face))) (defun ledger-occur-make-invisible-overlay (beg end) - (let ((ovl (make-overlay beg end (current-buffer)))) - (overlay-put ovl ledger-occur-overlay-property-name t) - (overlay-put ovl 'invisible t))) + (let ((ovl (make-overlay beg end (current-buffer)))) + (overlay-put ovl ledger-occur-overlay-property-name t) + (overlay-put ovl 'invisible t))) (defun ledger-occur-create-overlays (ovl-bounds) "Create the overlays for the visible transactions. Argument OVL-BOUNDS contains bounds for the transactions to be left visible." - (let* ((beg (caar ovl-bounds)) - (end (cadar ovl-bounds))) - (ledger-occur-make-invisible-overlay (point-min) (1- beg)) - (dolist (visible (cdr ovl-bounds)) - (ledger-occur-make-visible-overlay beg end) - (ledger-occur-make-invisible-overlay (1+ end) (1- (car visible))) - (setq beg (car visible)) - (setq end (cadr visible))) - (ledger-occur-make-invisible-overlay (1+ end) (point-max)))) - -(defun ledger-occur-quit-buffer (buffer) - "Quits hidings transaction in the given BUFFER. -Used for coordinating `ledger-occur' with other buffers, like reconcile." - (set-buffer buffer) - (setq ledger-occur-mode nil) - (force-mode-line-update) - (ledger-occur-remove-overlays) - (recenter)) + (let* ((beg (caar ovl-bounds)) + (end (cadar ovl-bounds))) + (ledger-occur-remove-overlays) + (ledger-occur-make-invisible-overlay (point-min) (1- beg)) + (dolist (visible (cdr ovl-bounds)) + (ledger-occur-make-visible-overlay beg end) + (ledger-occur-make-invisible-overlay (1+ end) (1- (car visible))) + (setq beg (car visible)) + (setq end (cadr visible))) + (ledger-occur-make-invisible-overlay (1+ end) (point-max)))) (defun ledger-occur-remove-overlays () "Remove the transaction hiding overlays." (interactive) (remove-overlays (point-min) - (point-max) ledger-occur-overlay-property-name t) - (setq ledger-occur-overlay-list nil)) + (point-max) ledger-occur-overlay-property-name t)) (defun ledger-occur-find-matches (regex) "Return a list of 2-number tuples describing the beginning and end of transactions meeting REGEX." (save-excursion (goto-char (point-min)) ;; Set initial values for variables - (let (curpoint - endpoint - (lines (list))) + (let (endpoint lines bounds) ;; Search loop (while (not (eobp)) - (setq curpoint (point)) ;; if something found (when (setq endpoint (re-search-forward regex nil 'end)) - (save-excursion - (let ((bounds (ledger-find-xact-extents (match-beginning 0)))) - (push bounds lines) - (setq curpoint (cadr bounds)))) ;; move to the end of - ;; the xact, no need to - ;; search inside it more - (goto-char curpoint)) - (forward-line 1)) - (setq lines (nreverse lines))))) + (setq bounds (ledger-navigate-find-element-extents endpoint)) + (push bounds lines) + ;; move to the end of the xact, no need to search inside it more + (goto-char (cadr bounds)))) + (nreverse lines)))) (defun ledger-occur-compress-matches (buffer-matches) - "identify sequential xacts to reduce number of overlays required" - (let ((points (list)) - (current-beginning (caar buffer-matches)) - (current-end (cadar buffer-matches))) - (dolist (match (cdr buffer-matches)) - (if (< (- (car match) current-end) 2) - (setq current-end (cadr match)) - (push (list current-beginning current-end) points) - (setq current-beginning (car match)) - (setq current-end (cadr match)))) - (nreverse (push (list current-beginning current-end) points)))) + "identify sequential xacts to reduce number of overlays required" + (if buffer-matches + (let ((points (list)) + (current-beginning (caar buffer-matches)) + (current-end (cadar buffer-matches))) + (dolist (match (cdr buffer-matches)) + (if (< (- (car match) current-end) 2) + (setq current-end (cadr match)) + (push (list current-beginning current-end) points) + (setq current-beginning (car match)) + (setq current-end (cadr match)))) + (nreverse (push (list current-beginning current-end) points))))) (provide 'ledger-occur) diff --git a/lisp/ledger-post.el b/lisp/ledger-post.el index 5d30e954..e0c7aaee 100644 --- a/lisp/ledger-post.el +++ b/lisp/ledger-post.el @@ -1,6 +1,6 @@ ;;; ledger-post.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. ;;; Commentary: @@ -42,25 +42,12 @@ :group 'ledger-post) (defcustom ledger-post-use-completion-engine :built-in - "Which completion engine to use, :iswitchb or :ido chose those engines, + "Which completion engine to use, :iswitchb or :ido chose those engines. :built-in uses built-in Ledger-mode completion" - :type '(radio (const :tag "built in completion" :built-in) - (const :tag "ido completion" :ido) - (const :tag "iswitchb completion" :iswitchb) ) - :group 'ledger-post) - -(defun ledger-post-all-accounts () - "Return a list of all accounts in the buffer." - (let ((origin (point)) - (ledger-post-list nil) - account elements) - (save-excursion - (goto-char (point-min)) - (while (re-search-forward ledger-post-line-regexp nil t) - (unless (and (>= origin (match-beginning 0)) - (< origin (match-end 0))) - (add-to-list 'ledger-post-list (ledger-regex-post-line-account)))) - (nreverse ledger-post-list)))) + :type '(radio (const :tag "built in completion" :built-in) + (const :tag "ido completion" :ido) + (const :tag "iswitchb completion" :iswitchb) ) + :group 'ledger-post) (declare-function iswitchb-read-buffer "iswitchb" (prompt &optional default require-match start matches-set)) @@ -72,47 +59,18 @@ PROMPT is a string to prompt with. CHOICES is a list of strings to choose from." (cond ((eq ledger-post-use-completion-engine :iswitchb) - (let* ((iswitchb-use-virtual-buffers nil) - (iswitchb-make-buflist-hook - (lambda () - (setq iswitchb-temp-buflist choices)))) - (iswitchb-read-buffer prompt))) - ((eq ledger-post-use-completion-engine :ido) - (ido-completing-read prompt choices)) - (t - (completing-read prompt choices)))) - -(defvar ledger-post-current-list nil) - -(defun ledger-post-pick-account () - "Insert an account entered by the user." - (interactive) - (let* ((account - (ledger-post-completing-read - "Account: " (or ledger-post-current-list - (setq ledger-post-current-list - (ledger-post-all-accounts))))) - (account-len (length account)) - (pos (point))) - (goto-char (line-beginning-position)) - (when (re-search-forward ledger-post-line-regexp (line-end-position) t) - (let ((existing-len (length (ledger-regex-post-line-account)))) - (goto-char (match-beginning ledger-regex-post-line-group-account)) - (delete-region (match-beginning ledger-regex-post-line-group-account) - (match-end ledger-regex-post-line-group-account)) - (insert account) - (cond - ((> existing-len account-len) - (insert (make-string (- existing-len account-len) ? ))) - ((< existing-len account-len) - (dotimes (n (- account-len existing-len)) - (if (looking-at "[ \t]\\( [ \t]\\|\t\\)") - (delete-char 1))))))) - (goto-char pos))) - - - -(defsubst ledger-next-amount (&optional end) + (let* ((iswitchb-use-virtual-buffers nil) + (iswitchb-make-buflist-hook + (lambda () + (setq iswitchb-temp-buflist choices)))) + (iswitchb-read-buffer prompt))) + ((eq ledger-post-use-completion-engine :ido) + (ido-completing-read prompt choices)) + (t + (completing-read prompt choices)))) + + +(defun ledger-next-amount (&optional end) "Move point to the next amount, as long as it is not past END. Return the width of the amount field as an integer and leave point at beginning of the commodity." @@ -124,82 +82,78 @@ point at beginning of the commodity." (- (or (match-end 4) (match-end 3)) (point))))) - (defun ledger-next-account (&optional end) - "Move point to the beginning of the next account, or status marker (!*), as long as it is not past END. + "Move to the beginning of the posting, or status marker, limit to END. Return the column of the beginning of the account and leave point at beginning of account" - (if (> end (point)) - (when (re-search-forward ledger-account-any-status-regex (1+ end) t) - ;; the 1+ is to make sure we can catch the newline - (if (match-beginning 1) - (goto-char (match-beginning 1)) - (goto-char (match-beginning 2))) - (current-column)))) + (if (> end (point)) + (when (re-search-forward ledger-account-any-status-regex (1+ end) t) + ;; the 1+ is to make sure we can catch the newline + (if (match-beginning 1) + (goto-char (match-beginning 1)) + (goto-char (match-beginning 2))) + (current-column)))) (defun ledger-post-align-xact (pos) + "Align all the posting in the xact at POS." (interactive "d") - (let ((bounds (ledger-find-xact-extents pos))) - (ledger-post-align-postings (car bounds) (cadr bounds)))) + (let ((bounds (ledger-navigate-find-xact-extents pos))) + (ledger-post-align-postings (car bounds) (cadr bounds)))) (defun ledger-post-align-postings (&optional beg end) - "Align all accounts and amounts within region, if there is no -region align the posting on the current line." + "Align all accounts and amounts between BEG and END, or the current line." (interactive) - (assert (eq major-mode 'ledger-mode)) (save-excursion (if (or (not (mark)) - (not (use-region-p))) - (set-mark (point))) - - (let* ((inhibit-modification-hooks t) - (mark-first (< (mark) (point))) - (begin-region (if beg - beg - (if mark-first (mark) (point)))) - (end-region (if end - end - (if mark-first (point) (mark)))) - acct-start-column acct-end-column acct-adjust amt-width - (lines-left 1)) - ;; Condition point and mark to the beginning and end of lines - (goto-char end-region) - (setq end-region (line-end-position)) - (goto-char begin-region) - (goto-char - (setq begin-region - (line-beginning-position))) - - ;; This is the guts of the alignment loop - (while (and (or (setq acct-start-column (ledger-next-account (line-end-position))) - lines-left) - (< (point) end-region)) - (when acct-start-column - (setq acct-end-column (save-excursion - (goto-char (match-end 2)) - (current-column))) - (when (/= (setq acct-adjust (- ledger-post-account-alignment-column acct-start-column)) 0) - (setq acct-end-column (+ acct-end-column acct-adjust)) ;;adjust the account ending column - (if (> acct-adjust 0) - (insert (make-string acct-adjust ? )) - (delete-char acct-adjust))) - (when (setq amt-width (ledger-next-amount (line-end-position))) - (if (/= 0 (setq amt-adjust (- (if (> (- ledger-post-amount-alignment-column amt-width) - (+ 2 acct-end-column)) - ledger-post-amount-alignment-column ;;we have room - (+ acct-end-column 2 amt-width)) - amt-width - (current-column)))) - (if (> amt-adjust 0) - (insert (make-string amt-adjust ? )) - (delete-char amt-adjust))))) - (forward-line) - (setq lines-left (not (eobp)))) + (not (use-region-p))) + (set-mark (point))) + + (let ((inhibit-modification-hooks t) + (mark-first (< (mark) (point))) + acct-start-column acct-end-column acct-adjust amt-width amt-adjust + (lines-left 1)) + + (unless beg (setq beg (if mark-first (mark) (point)))) + (unless end (setq end (if mark-first (mark) (point)))) + + ;; Extend region to whole lines + (let ((start-marker (set-marker (make-marker) (save-excursion + (goto-char beg) + (line-beginning-position)))) + (end-marker (set-marker (make-marker) (save-excursion + (goto-char end) + (line-end-position))))) + (untabify start-marker end-marker) + (goto-char start-marker) + + ;; This is the guts of the alignment loop + (while (and (or (setq acct-start-column (ledger-next-account (line-end-position))) + lines-left) + (< (point) end-marker)) + (when acct-start-column + (setq acct-end-column (save-excursion + (goto-char (match-end 2)) + (current-column))) + (when (/= (setq acct-adjust (- ledger-post-account-alignment-column acct-start-column)) 0) + (setq acct-end-column (+ acct-end-column acct-adjust)) ;;adjust the account ending column + (if (> acct-adjust 0) + (insert (make-string acct-adjust ? )) + (delete-char acct-adjust))) + (when (setq amt-width (ledger-next-amount (line-end-position))) + (if (/= 0 (setq amt-adjust (- (if (> (- ledger-post-amount-alignment-column amt-width) + (+ 2 acct-end-column)) + ledger-post-amount-alignment-column ;;we have room + (+ acct-end-column 2 amt-width)) + amt-width + (current-column)))) + (if (> amt-adjust 0) + (insert (make-string amt-adjust ? )) + (delete-char amt-adjust))))) + (forward-line) + (setq lines-left (not (eobp))))) (setq inhibit-modification-hooks nil)))) - - (defun ledger-post-edit-amount () "Call 'calc-mode' and push the amount in the posting to the top of stack." (interactive) @@ -209,39 +163,16 @@ region align the posting on the current line." (let ((end-of-amount (re-search-forward "[-.,0-9]+" (line-end-position) t))) ;; determine if there is an amount to edit (if end-of-amount - (let ((val (ledger-string-to-number (match-string 0)))) - (goto-char (match-beginning 0)) - (delete-region (match-beginning 0) (match-end 0)) - (calc) - (calc-eval val 'push)) ;; edit the amount - (progn ;;make sure there are two spaces after the account name and go to calc - (if (search-backward " " (- (point) 3) t) - (goto-char (line-end-position)) - (insert " ")) - (calc)))))) - -(defun ledger-post-prev-xact () - "Move point to the previous transaction." - (interactive) - (backward-paragraph) - (when (re-search-backward ledger-xact-line-regexp nil t) - (goto-char (match-beginning 0)) - (re-search-forward ledger-post-line-regexp) - (goto-char (match-end ledger-regex-post-line-group-account)))) - -(defun ledger-post-next-xact () - "Move point to the next transaction." - (interactive) - (when (re-search-forward ledger-xact-line-regexp nil t) - (goto-char (match-beginning 0)) - (re-search-forward ledger-post-line-regexp) - (goto-char (match-end ledger-regex-post-line-group-account)))) - -(defun ledger-post-setup () - "Configure `ledger-mode' to auto-align postings." - (add-hook 'after-save-hook #'(lambda () (setq ledger-post-current-list nil)) t t)) - - + (let ((val-string (match-string 0))) + (goto-char (match-beginning 0)) + (delete-region (match-beginning 0) (match-end 0)) + (calc) + (calc-eval val-string 'push)) ;; edit the amount + (progn ;;make sure there are two spaces after the account name and go to calc + (if (search-backward " " (- (point) 3) t) + (goto-char (line-end-position)) + (insert " ")) + (calc)))))) (provide 'ledger-post) diff --git a/lisp/ledger-reconcile.el b/lisp/ledger-reconcile.el index 8ca78dbc..80e27ae3 100644 --- a/lisp/ledger-reconcile.el +++ b/lisp/ledger-reconcile.el @@ -1,6 +1,6 @@ ;;; ledger-reconcile.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. ;; Reconcile mode @@ -27,13 +27,16 @@ ;;; Code: +(require 'easymenu) +(require 'ledger-init) + (defvar ledger-buf nil) (defvar ledger-bufs nil) (defvar ledger-acct nil) (defvar ledger-target nil) (defgroup ledger-reconcile nil - "Options for Ledger-mode reconciliation" + "Options for Ledger-mode reconciliation" :group 'ledger) (defcustom ledger-recon-buffer-name "*Reconcile*" @@ -59,26 +62,51 @@ Then that transaction will be shown in its source buffer." (defcustom ledger-reconcile-toggle-to-pending t "If true then toggle between uncleared and pending. reconcile-finish will mark all pending posting cleared." - :type 'boolean - :group 'ledger-reconcile) + :type 'boolean + :group 'ledger-reconcile) -(defcustom ledger-reconcile-default-date-format "%Y/%m/%d" - "Default date format for the reconcile buffer" +(defcustom ledger-reconcile-default-date-format ledger-default-date-format + "Default date format for the reconcile buffer." :type 'string :group 'ledger-reconcile) (defcustom ledger-reconcile-target-prompt-string "Target amount for reconciliation " - "Default prompt for recon target prompt" + "Default prompt for recon target prompt." :type 'string :group 'ledger-reconcile) -(defcustom ledger-reconcile-sort-key "(date)" - "Default key for sorting reconcile buffer. For no sorting by default, use '(0)'." +(defcustom ledger-reconcile-buffer-header "Reconciling account %s\n\n" + "Default header string for the reconcile buffer. + +If non-nil, the name of the account being reconciled will be substituted + into the '%s'. If nil, no header willbe displayed." + :type 'string + :group 'ledger-reconcile) + +(defcustom ledger-reconcile-buffer-line-format "%(date)s %-4(code)s %-50(payee)s %-30(account)s %15(amount)s\n" + "Format string for the ledger reconcile posting format. +Available fields are date, status, code, payee, account, +amount. The format for each field is %WIDTH(FIELD), WIDTH can be +preced by a minus sign which mean to left justify and pad the +field." :type 'string :group 'ledger-reconcile) +(defcustom ledger-reconcile-sort-key "(0)" + "Default key for sorting reconcile buffer. + +Possible values are '(date)', '(amount)', '(payee)'. For no sorting, i.e. using +ledger file order, use '(0)'." + :type 'string + :group 'ledger-reconcile) + +(defcustom ledger-reconcile-insert-effective-date nil + "If t, prompt for effective date when clearing transactions during reconciliation." + :type 'boolean + :group 'ledger-reconcile) + (defun ledger-reconcile-get-cleared-or-pending-balance (buffer account) - "Calculate the cleared or pending balance of the account." + "Use BUFFER to Calculate the cleared or pending balance of the ACCOUNT." ;; these vars are buffer local, need to hold them for use in the ;; temp buffer below @@ -89,10 +117,10 @@ reconcile-finish will mark all pending posting cleared." ;; split arguments like the shell does, so you need to ;; specify the individual fields in the command line. (if (ledger-exec-ledger buffer (current-buffer) - "balance" "--limit" "cleared or pending" "--empty" "--collapse" - "--format" "%(display_total)" account) - (ledger-split-commodity-string - (buffer-substring-no-properties (point-min) (point-max)))))) + "balance" "--limit" "cleared or pending" "--empty" "--collapse" + "--format" "%(scrub(display_total))" account) + (ledger-split-commodity-string + (buffer-substring-no-properties (point-min) (point-max)))))) (defun ledger-display-balance () "Display the cleared-or-pending balance. @@ -100,14 +128,14 @@ And calculate the target-delta of the account being reconciled." (interactive) (let* ((pending (ledger-reconcile-get-cleared-or-pending-balance ledger-buf ledger-acct))) (when pending - (if ledger-target - (message "Pending balance: %s, Difference from target: %s" - (ledger-commodity-to-string pending) - (ledger-commodity-to-string (-commodity ledger-target pending))) - (message "Pending balance: %s" - (ledger-commodity-to-string pending)))))) - -(defun is-stdin (file) + (if ledger-target + (message "Cleared and Pending balance: %s, Difference from target: %s" + (ledger-commodity-to-string pending) + (ledger-commodity-to-string (-commodity ledger-target pending))) + (message "Pending balance: %s" + (ledger-commodity-to-string pending)))))) + +(defun ledger-is-stdin (file) "True if ledger FILE is standard input." (or (equal file "") @@ -118,7 +146,7 @@ And calculate the target-delta of the account being reconciled." "Return a buffer from WHERE the transaction is." (if (bufferp (car where)) (car where) - (error "Function ledger-reconcile-get-buffer: Buffer not set"))) + (error "Function ledger-reconcile-get-buffer: Buffer not set"))) (defun ledger-reconcile-toggle () "Toggle the current transaction, and mark the recon window." @@ -129,27 +157,30 @@ And calculate the target-delta of the account being reconciled." status) (when (ledger-reconcile-get-buffer where) (with-current-buffer (ledger-reconcile-get-buffer where) - (ledger-goto-line (cdr where)) - (forward-char) - (setq status (ledger-toggle-current (if ledger-reconcile-toggle-to-pending - 'pending - 'cleared)))) - ;; remove the existing face and add the new face + (ledger-navigate-to-line (cdr where)) + (forward-char) + (setq status (ledger-toggle-current (if ledger-reconcile-toggle-to-pending + 'pending + 'cleared))) + (when ledger-reconcile-insert-effective-date + ;; Ask for effective date & insert it + (ledger-insert-effective-date))) + ;; remove the existing face and add the new face (remove-text-properties (line-beginning-position) - (line-end-position) - (list 'face)) + (line-end-position) + (list 'face)) (cond ((eq status 'pending) - (add-text-properties (line-beginning-position) - (line-end-position) - (list 'face 'ledger-font-reconciler-pending-face ))) - ((eq status 'cleared) - (add-text-properties (line-beginning-position) - (line-end-position) - (list 'face 'ledger-font-reconciler-cleared-face ))) - (t - (add-text-properties (line-beginning-position) - (line-end-position) - (list 'face 'ledger-font-reconciler-uncleared-face ))))) + (add-text-properties (line-beginning-position) + (line-end-position) + (list 'face 'ledger-font-reconciler-pending-face ))) + ((eq status 'cleared) + (add-text-properties (line-beginning-position) + (line-end-position) + (list 'face 'ledger-font-reconciler-cleared-face ))) + (t + (add-text-properties (line-beginning-position) + (line-end-position) + (list 'face 'ledger-font-reconciler-uncleared-face ))))) (forward-line) (beginning-of-line) (ledger-display-balance))) @@ -161,20 +192,21 @@ Return the number of uncleared xacts found." (let ((inhibit-read-only t)) (erase-buffer) (prog1 - (ledger-do-reconcile ledger-reconcile-sort-key) + (ledger-do-reconcile ledger-reconcile-sort-key) (set-buffer-modified-p t)))) (defun ledger-reconcile-refresh-after-save () "Refresh the recon-window after the ledger buffer is saved." - (let ((curbuf (current-buffer)) - (curpoint (point)) - (recon-buf (get-buffer ledger-recon-buffer-name))) + (let ((curbufwin (get-buffer-window (current-buffer))) + (curpoint (point)) + (recon-buf (get-buffer ledger-recon-buffer-name))) (when (buffer-live-p recon-buf) (with-current-buffer recon-buf - (ledger-reconcile-refresh) - (set-buffer-modified-p nil)) - (select-window (get-buffer-window curbuf)) - (goto-char curpoint)))) + (ledger-reconcile-refresh) + (set-buffer-modified-p nil)) + (when curbufwin + (select-window curbufwin) + (goto-char curpoint))))) (defun ledger-reconcile-add () "Use ledger xact to add a new transaction." @@ -189,45 +221,46 @@ Return the number of uncleared xacts found." (let ((where (get-text-property (point) 'where))) (when (ledger-reconcile-get-buffer where) (with-current-buffer (ledger-reconcile-get-buffer where) - (ledger-goto-line (cdr where)) - (ledger-delete-current-transaction)) + (ledger-navigate-to-line (cdr where)) + (ledger-delete-current-transaction (point))) (let ((inhibit-read-only t)) (goto-char (line-beginning-position)) (delete-region (point) (1+ (line-end-position))) - (set-buffer-modified-p t))))) + (set-buffer-modified-p t)) + (ledger-reconcile-refresh)))) (defun ledger-reconcile-visit (&optional come-back) "Recenter ledger buffer on transaction and COME-BACK if non-nil." (interactive) - (progn - (beginning-of-line) - (let* ((where (get-text-property (1+ (point)) 'where)) - (target-buffer (if where - (ledger-reconcile-get-buffer where) - nil)) - (cur-win (get-buffer-window (get-buffer ledger-recon-buffer-name)))) - (when target-buffer - (switch-to-buffer-other-window target-buffer) - (ledger-goto-line (cdr where)) - (forward-char) - (recenter) - (ledger-highlight-xact-under-point) - (forward-char -1) - (if (and come-back cur-win) - (select-window cur-win)))))) + (beginning-of-line) + (let* ((where (get-text-property (1+ (point)) 'where)) + (target-buffer (if where + (ledger-reconcile-get-buffer where) + nil)) + (cur-win (get-buffer-window (get-buffer ledger-recon-buffer-name)))) + (when target-buffer + (switch-to-buffer-other-window target-buffer) + (ledger-navigate-to-line (cdr where)) + (forward-char) + (recenter) + (ledger-highlight-xact-under-point) + (forward-char -1) + (when (and come-back cur-win) + (select-window cur-win) + (get-buffer ledger-recon-buffer-name))))) + (defun ledger-reconcile-save () "Save the ledger buffer." (interactive) - (let ((curpoint (point))) - (dolist (buf (cons ledger-buf ledger-bufs)) - (with-current-buffer buf - (save-buffer))) - (with-current-buffer (get-buffer ledger-recon-buffer-name) - (set-buffer-modified-p nil) - (ledger-display-balance) - (goto-char curpoint) - (ledger-reconcile-visit t)))) + (let ((cur-buf (current-buffer)) + (cur-point (point))) + (dolist (buf (cons ledger-buf ledger-bufs)) + (with-current-buffer buf + (basic-save-buffer))) + (switch-to-buffer-other-window cur-buf) + (goto-char cur-point))) + (defun ledger-reconcile-finish () "Mark all pending posting or transactions as cleared. @@ -241,162 +274,198 @@ and exit reconcile mode" (face (get-text-property (point) 'face))) (if (eq face 'ledger-font-reconciler-pending-face) (with-current-buffer (ledger-reconcile-get-buffer where) - (ledger-goto-line (cdr where)) + (ledger-navigate-to-line (cdr where)) (ledger-toggle-current 'cleared)))) (forward-line 1))) (ledger-reconcile-save) - (ledger-reconcile-quit)) + (ledger-reconcile-quit)) (defun ledger-reconcile-quit () "Quit the reconcile window without saving ledger buffer." (interactive) (let ((recon-buf (get-buffer ledger-recon-buffer-name)) - buf) + buf) (if recon-buf - (with-current-buffer recon-buf - (ledger-reconcile-quit-cleanup) - (setq buf ledger-buf) - ;; Make sure you delete the window before you delete the buffer, - ;; otherwise, madness ensues - (delete-window (get-buffer-window recon-buf)) - (kill-buffer recon-buf) - (set-window-buffer (selected-window) buf))))) + (with-current-buffer recon-buf + (ledger-reconcile-quit-cleanup) + (setq buf ledger-buf) + ;; Make sure you delete the window before you delete the buffer, + ;; otherwise, madness ensues + (delete-window (get-buffer-window recon-buf)) + (kill-buffer recon-buf) + (set-window-buffer (selected-window) buf))))) (defun ledger-reconcile-quit-cleanup () "Cleanup all hooks established by reconcile mode." (interactive) (let ((buf ledger-buf)) (if (buffer-live-p buf) - (with-current-buffer buf - (remove-hook 'after-save-hook 'ledger-reconcile-refresh-after-save t) - (when ledger-narrow-on-reconcile - (ledger-occur-quit-buffer buf) - (ledger-highlight-xact-under-point)))))) + (with-current-buffer buf + (remove-hook 'after-save-hook 'ledger-reconcile-refresh-after-save t) + (when ledger-narrow-on-reconcile + (ledger-occur-mode -1) + (ledger-highlight-xact-under-point)))))) (defun ledger-marker-where-xact-is (emacs-xact posting) "Find the position of the EMACS-XACT in the `ledger-buf'. POSTING is used in `ledger-clear-whole-transactions' is nil." - (let ((buf (if (is-stdin (nth 0 emacs-xact)) - ledger-buf - (find-file-noselect (nth 0 emacs-xact))))) + (let ((buf (if (ledger-is-stdin (nth 0 emacs-xact)) + ledger-buf + (find-file-noselect (nth 0 emacs-xact))))) (cons buf (if ledger-clear-whole-transactions - (nth 1 emacs-xact) ;; return line-no of xact - (nth 0 posting))))) ;; return line-no of posting + (nth 1 emacs-xact) ;; return line-no of xact + (nth 0 posting))))) ;; return line-no of posting + +(defun ledger-reconcile-compile-format-string (fstr) + "Return a function that implements the format string in FSTR." + (let (fields + (start 0)) + (while (string-match "(\\(.*?\\))" fstr start) + (setq fields (cons (intern (match-string 1 fstr)) fields)) + (setq start (match-end 0))) + (setq fields (list* 'format (replace-regexp-in-string "(.*?)" "" fstr) (nreverse fields))) + `(lambda (date code status payee account amount) + ,fields))) + + + +(defun ledger-reconcile-format-posting (beg where fmt date code status payee account amount) + "Format posting for the reconcile buffer." + (insert (funcall fmt date code status payee account amount)) + + ; Set face depending on cleared status + (if status + (if (eq status 'pending) + (set-text-properties beg (1- (point)) + (list 'face 'ledger-font-reconciler-pending-face + 'where where)) + (set-text-properties beg (1- (point)) + (list 'face 'ledger-font-reconciler-cleared-face + 'where where))) + (set-text-properties beg (1- (point)) + (list 'face 'ledger-font-reconciler-uncleared-face + 'where where)))) + +(defun ledger-reconcile-format-xact (xact fmt) + "Format XACT using FMT." + (let ((date-format (or (cdr (assoc "date-format" ledger-environment-alist)) + ledger-default-date-format))) + (dolist (posting (nthcdr 5 xact)) + (let ((beg (point)) + (where (ledger-marker-where-xact-is xact posting))) + (ledger-reconcile-format-posting beg + where + fmt + (format-time-string date-format (nth 2 xact)) ; date + (if (nth 3 xact) (nth 3 xact) "") ; code + (nth 3 posting) ; status + (nth 4 xact) ; payee + (nth 1 posting) ; account + (nth 2 posting)))))) ; amount (defun ledger-do-reconcile (&optional sort) - "Return the number of uncleared transactions in the account and display them in the *Reconcile* buffer." + "SORT the uncleared transactions in the account and display them in the *Reconcile* buffer. +Return a count of the uncleared transactions." (let* ((buf ledger-buf) (account ledger-acct) - (ledger-success nil) - (sort-by (if sort - sort - "(date)")) + (ledger-success nil) + (sort-by (if sort + sort + "(date)")) (xacts (with-temp-buffer - (when (ledger-exec-ledger buf (current-buffer) - "--uncleared" "--real" "emacs" "--sort" sort-by account) - (setq ledger-success t) - (goto-char (point-min)) - (unless (eobp) - (if (looking-at "(") - (read (current-buffer)))))))) ;current-buffer is the *temp* created above + (when (ledger-exec-ledger buf (current-buffer) + "--uncleared" "--real" "emacs" "--sort" sort-by account) + (setq ledger-success t) + (goto-char (point-min)) + (unless (eobp) + (if (looking-at "(") + (read (current-buffer))))))) ;current-buffer is the *temp* created above + (fmt (ledger-reconcile-compile-format-string ledger-reconcile-buffer-line-format))) (if (and ledger-success (> (length xacts) 0)) - (let ((date-format (cdr (assoc "date-format" ledger-environment-alist)))) - (dolist (xact xacts) - (dolist (posting (nthcdr 5 xact)) - (let ((beg (point)) - (where (ledger-marker-where-xact-is xact posting))) - (insert (format "%s %-4s %-30s %-30s %15s\n" - (format-time-string (if date-format - date-format - ledger-reconcile-default-date-format) (nth 2 xact)) - (if (nth 3 xact) - (nth 3 xact) - "") - (nth 4 xact) (nth 1 posting) (nth 2 posting))) - (if (nth 3 posting) - (if (eq (nth 3 posting) 'pending) - (set-text-properties beg (1- (point)) - (list 'face 'ledger-font-reconciler-pending-face - 'where where)) - (set-text-properties beg (1- (point)) - (list 'face 'ledger-font-reconciler-cleared-face - 'where where))) - (set-text-properties beg (1- (point)) - (list 'face 'ledger-font-reconciler-uncleared-face - 'where where)))) )) - (goto-char (point-max)) - (delete-char -1)) ;gets rid of the extra line feed at the bottom of the list - (if ledger-success - (insert (concat "There are no uncleared entries for " account)) - (insert "Ledger has reported a problem. Check *Ledger Error* buffer."))) + (progn + (insert (format ledger-reconcile-buffer-header account)) + (dolist (xact xacts) + (ledger-reconcile-format-xact xact fmt)) + (goto-char (point-max)) + (delete-char -1)) ;gets rid of the extra line feed at the bottom of the list + (if ledger-success + (insert (concat "There are no uncleared entries for " account)) + (insert "Ledger has reported a problem. Check *Ledger Error* buffer."))) (goto-char (point-min)) (set-buffer-modified-p nil) - (toggle-read-only t) + (setq buffer-read-only t) (ledger-reconcile-ensure-xacts-visible) (length xacts))) (defun ledger-reconcile-ensure-xacts-visible () - "Ensures that the last of the visible transactions in the -ledger buffer is at the bottom of the main window. The key to -this is to ensure the window is selected when the buffer point is + "Ensure the last of the visible transactions in the ledger buffer is at the bottom of the main window. +The key to this is to ensure the window is selected when the buffer point is moved and recentered. If they aren't strange things happen." - (let ((recon-window (get-buffer-window (get-buffer ledger-recon-buffer-name)))) - (when recon-window - (fit-window-to-buffer recon-window) - (with-current-buffer buf - (add-hook 'kill-buffer-hook 'ledger-reconcile-quit nil t) - (if (get-buffer-window buf) - (select-window (get-buffer-window buf))) - (goto-char (point-max)) - (recenter -1)) - (select-window recon-window) - (ledger-reconcile-visit t)) - (add-hook 'post-command-hook 'ledger-reconcile-track-xact nil t))) + (let ((recon-window (get-buffer-window (get-buffer ledger-recon-buffer-name)))) + (when recon-window + (fit-window-to-buffer recon-window) + (with-current-buffer ledger-buf + (add-hook 'kill-buffer-hook 'ledger-reconcile-quit nil t) + (if (get-buffer-window ledger-buf) + (select-window (get-buffer-window ledger-buf))) + (goto-char (point-max)) + (recenter -1)) + (select-window recon-window) + (ledger-reconcile-visit t)) + (add-hook 'post-command-hook 'ledger-reconcile-track-xact nil t))) (defun ledger-reconcile-track-xact () "Force the ledger buffer to recenter on the transaction at point in the reconcile buffer." (if (and ledger-buffer-tracks-reconcile-buffer - (member this-command (list 'next-line - 'previous-line - 'mouse-set-point - 'ledger-reconcile-toggle - 'end-of-buffer - 'beginning-of-buffer))) + (member this-command (list 'next-line + 'previous-line + 'mouse-set-point + 'ledger-reconcile-toggle + 'end-of-buffer + 'beginning-of-buffer))) (save-excursion - (ledger-reconcile-visit t)))) + (ledger-reconcile-visit t)))) (defun ledger-reconcile-open-windows (buf rbuf) "Ensure that the ledger buffer BUF is split by RBUF." (if ledger-reconcile-force-window-bottom ;;create the *Reconcile* window directly below the ledger buffer. (set-window-buffer (split-window (get-buffer-window buf) nil nil) rbuf) - (pop-to-buffer rbuf))) + (pop-to-buffer rbuf))) + +(defun ledger-reconcile-check-valid-account (account) + "Check to see if ACCOUNT exists in the ledger file" + (if (> (length account) 0) + (save-excursion + (goto-char (point-min)) + (search-forward account nil t)))) (defun ledger-reconcile () "Start reconciling, prompt for account." (interactive) (let ((account (ledger-read-account-with-prompt "Account to reconcile")) - (buf (current-buffer)) + (buf (current-buffer)) (rbuf (get-buffer ledger-recon-buffer-name))) - (add-hook 'after-save-hook 'ledger-reconcile-refresh-after-save nil t) + (when (ledger-reconcile-check-valid-account account) + (add-hook 'after-save-hook 'ledger-reconcile-refresh-after-save nil t) - (if rbuf ;; *Reconcile* already exists - (with-current-buffer rbuf - (set 'ledger-acct account) ;; already buffer local - (when (not (eq buf rbuf)) - ;; called from some other ledger-mode buffer - (ledger-reconcile-quit-cleanup) - (set 'ledger-buf buf)) ;; should already be buffer-local + (if rbuf ;; *Reconcile* already exists + (with-current-buffer rbuf + (set 'ledger-acct account) ;; already buffer local + (when (not (eq buf rbuf)) + ;; called from some other ledger-mode buffer + (ledger-reconcile-quit-cleanup) + (setq ledger-buf buf)) ;; should already be buffer-local - (unless (get-buffer-window rbuf) - (ledger-reconcile-open-windows buf rbuf))) + (unless (get-buffer-window rbuf) + (ledger-reconcile-open-windows buf rbuf))) ;; no recon-buffer, starting from scratch. @@ -408,14 +477,14 @@ moved and recentered. If they aren't strange things happen." (set (make-local-variable 'ledger-buf) buf) (set (make-local-variable 'ledger-acct) account))) - ;; Narrow the ledger buffer - (with-current-buffer rbuf - (save-excursion - (if ledger-narrow-on-reconcile - (ledger-occur-mode account ledger-buf))) - (if (> (ledger-reconcile-refresh) 0) - (ledger-reconcile-change-target)) - (ledger-display-balance)))) + ;; Narrow the ledger buffer + (with-current-buffer rbuf + (save-excursion + (if ledger-narrow-on-reconcile + (ledger-occur account))) + (if (> (ledger-reconcile-refresh) 0) + (ledger-reconcile-change-target)) + (ledger-display-balance))))) (defvar ledger-reconcile-mode-abbrev-table) @@ -425,65 +494,71 @@ moved and recentered. If they aren't strange things happen." (setq ledger-target (ledger-read-commodity-string ledger-reconcile-target-prompt-string))) (defmacro ledger-reconcile-change-sort-key-and-refresh (sort-by) + "Set the sort-key to SORT-BY." `(lambda () - (interactive) - - (setq ledger-reconcile-sort-key ,sort-by) - (ledger-reconcile-refresh))) + (interactive) + + (setq ledger-reconcile-sort-key ,sort-by) + (ledger-reconcile-refresh))) + +(defvar ledger-reconcile-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [(control ?m)] 'ledger-reconcile-visit) + (define-key map [return] 'ledger-reconcile-visit) + (define-key map [(control ?x) (control ?s)] 'ledger-reconcile-save) + (define-key map [(control ?l)] 'ledger-reconcile-refresh) + (define-key map [(control ?c) (control ?c)] 'ledger-reconcile-finish) + (define-key map [? ] 'ledger-reconcile-toggle) + (define-key map [?a] 'ledger-reconcile-add) + (define-key map [?d] 'ledger-reconcile-delete) + (define-key map [?g] 'ledger-reconcile); + (define-key map [?n] 'next-line) + (define-key map [?p] 'previous-line) + (define-key map [?t] 'ledger-reconcile-change-target) + (define-key map [?s] 'ledger-reconcile-save) + (define-key map [?q] 'ledger-reconcile-quit) + (define-key map [?b] 'ledger-display-balance) + + (define-key map [(control ?c) (control ?o)] (ledger-reconcile-change-sort-key-and-refresh "(0)")) + + (define-key map [(control ?c) (control ?a)] (ledger-reconcile-change-sort-key-and-refresh "(amount)")) + + (define-key map [(control ?c) (control ?d)] (ledger-reconcile-change-sort-key-and-refresh "(date)")) + + (define-key map [(control ?c) (control ?p)] (ledger-reconcile-change-sort-key-and-refresh "(payee)")) + map) + "Keymap for `ledger-reconcile-mode'.") + +(easy-menu-define ledger-reconcile-mode-menu ledger-reconcile-mode-map + "Ledger reconcile menu" + `("Reconcile" + ["Save" ledger-reconcile-save] + ["Refresh" ledger-reconcile-refresh] + ["Finish" ledger-reconcile-finish] + "---" + ["Reconcile New Account" ledger-reconcile] + "---" + ["Change Target Balance" ledger-reconcile-change-target] + ["Show Cleared Balance" ledger-display-balance] + "---" + ["Sort by payee" ,(ledger-reconcile-change-sort-key-and-refresh "(payee)")] + ["Sort by date" ,(ledger-reconcile-change-sort-key-and-refresh "(date)")] + ["Sort by amount" ,(ledger-reconcile-change-sort-key-and-refresh "(amount)")] + ["Sort by file order" ,(ledger-reconcile-change-sort-key-and-refresh "(0)")] + "---" + ["Toggle Entry" ledger-reconcile-toggle] + ["Add Entry" ledger-reconcile-add] + ["Delete Entry" ledger-reconcile-delete] + "---" + ["Next Entry" next-line] + ["Visit Source" ledger-reconcile-visit] + ["Previous Entry" previous-line] + "---" + ["Quit" ledger-reconcile-quit] + )) (define-derived-mode ledger-reconcile-mode text-mode "Reconcile" - "A mode for reconciling ledger entries." - (let ((map (make-sparse-keymap))) - (define-key map [(control ?m)] 'ledger-reconcile-visit) - (define-key map [return] 'ledger-reconcile-visit) - (define-key map [(control ?l)] 'ledger-reconcile-refresh) - (define-key map [(control ?c) (control ?c)] 'ledger-reconcile-finish) - (define-key map [? ] 'ledger-reconcile-toggle) - (define-key map [?a] 'ledger-reconcile-add) - (define-key map [?d] 'ledger-reconcile-delete) - (define-key map [?g] 'ledger-reconcile); - (define-key map [?n] 'next-line) - (define-key map [?p] 'previous-line) - (define-key map [?t] 'ledger-reconcile-change-target) - (define-key map [?s] 'ledger-reconcile-save) - (define-key map [?q] 'ledger-reconcile-quit) - (define-key map [?b] 'ledger-display-balance) - - (define-key map [(control ?c) (control ?o)] (ledger-reconcile-change-sort-key-and-refresh "(0)")) - - (define-key map [(control ?c) (control ?a)] (ledger-reconcile-change-sort-key-and-refresh "(amount)")) - - (define-key map [(control ?c) (control ?d)] (ledger-reconcile-change-sort-key-and-refresh "(date)")) - - (define-key map [(control ?c) (control ?p)] (ledger-reconcile-change-sort-key-and-refresh "(payee)")) - - (define-key map [menu-bar] (make-sparse-keymap "ledger-recon-menu")) - (define-key map [menu-bar ledger-recon-menu] (cons "Reconcile" map)) - (define-key map [menu-bar ledger-recon-menu qui] '("Quit" . ledger-reconcile-quit)) - (define-key map [menu-bar ledger-recon-menu sep1] '("--")) - (define-key map [menu-bar ledger-recon-menu pre] '("Previous Entry" . previous-line)) - (define-key map [menu-bar ledger-recon-menu vis] '("Visit Source" . ledger-reconcile-visit)) - (define-key map [menu-bar ledger-recon-menu nex] '("Next Entry" . next-line)) - (define-key map [menu-bar ledger-recon-menu sep2] '("--")) - (define-key map [menu-bar ledger-recon-menu del] '("Delete Entry" . ledger-reconcile-delete)) - (define-key map [menu-bar ledger-recon-menu add] '("Add Entry" . ledger-reconcile-add)) - (define-key map [menu-bar ledger-recon-menu tog] '("Toggle Entry" . ledger-reconcile-toggle)) - (define-key map [menu-bar ledger-recon-menu sep3] '("--")) - (define-key map [menu-bar ledger-recon-menu sort-orig] `("Sort by file order" . ,(ledger-reconcile-change-sort-key-and-refresh "(0)"))) - (define-key map [menu-bar ledger-recon-menu sort-amt] `("Sort by amount" . ,(ledger-reconcile-change-sort-key-and-refresh "(amount)"))) - (define-key map [menu-bar ledger-recon-menu sort-pay] `("Sort by date" . ,(ledger-reconcile-change-sort-key-and-refresh "(date)"))) - (define-key map [menu-bar ledger-recon-menu sort-dat] `("Sort by payee" . ,(ledger-reconcile-change-sort-key-and-refresh "(payee)"))) - (define-key map [menu-bar ledger-recon-menu sep4] '("--")) - (define-key map [menu-bar ledger-recon-menu bal] '("Show Cleared Balance" . ledger-display-balance)) - (define-key map [menu-bar ledger-recon-menu tgt] '("Change Target Balance" . ledger-reconcile-change-target)) - (define-key map [menu-bar ledger-recon-menu sep5] '("--")) - (define-key map [menu-bar ledger-recon-menu rna] '("Reconcile New Account" . ledger-reconcile)) - (define-key map [menu-bar ledger-recon-menu sep6] '("--")) - (define-key map [menu-bar ledger-recon-menu fin] '("Finish" . ledger-reconcile-finish)) - (define-key map [menu-bar ledger-recon-menu ref] '("Refresh" . ledger-reconcile-refresh)) - (define-key map [menu-bar ledger-recon-menu sav] '("Save" . ledger-reconcile-save)) - - (use-local-map map))) + "A mode for reconciling ledger entries.") (provide 'ledger-reconcile) diff --git a/lisp/ledger-regex.el b/lisp/ledger-regex.el index 77ce38c6..41231845 100644 --- a/lisp/ledger-regex.el +++ b/lisp/ledger-regex.el @@ -1,6 +1,6 @@ ;;; ledger-regex.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. (require 'rx) @@ -26,12 +26,12 @@ (defconst ledger-amount-regex (concat "\\( \\|\t\\| \t\\)[ \t]*-?" - "\\([A-Z$€£_]+ *\\)?" - "\\(-?[0-9,]+?\\)" - "\\(.[0-9]+\\)?" - "\\( *[[:word:]€£_\"]+\\)?" - "\\([ \t]*[@={]@?[^\n;]+?\\)?" - "\\([ \t]+;.+?\\|[ \t]*\\)?$")) + "\\([A-Z$€£₹_(]+ *\\)?" + "\\(-?[0-9,\\.]+?\\)" + "\\(.[0-9)]+\\)?" + "\\( *[[:word:]€£₹_\"]+\\)?" + "\\([ \t]*[@={]@?[^\n;]+?\\)?" + "\\([ \t]+;.+?\\|[ \t]*\\)?$")) (defconst ledger-amount-decimal-comma-regex "-?[1-9][0-9.]*[,]?[0-9]*") @@ -68,10 +68,10 @@ "^--.+?\\($\\|[ ]\\)") (defconst ledger-account-any-status-regex - "^[ \t]+\\([*!]\\s-+\\)?\\([[(]?.+?\\)\\(\t\\|\n\\| [ \t]\\)") + "^[ \t]+\\([*!]\\s-+\\)?\\([[(]?.+?\\)\\(\t\\|\n\\| [ \t]\\)") (defun ledger-account-any-status-with-seed-regex (seed) - (concat "^[ \t]+\\([*!]\\s-+\\)?\\([[(]?" seed ".+?\\)\\(\t\\|\n\\| [ \t]\\)")) + (concat "^[ \t]+\\([*!]\\s-+\\)?\\([[(]?" seed ".+?\\)\\(\t\\|\n\\| [ \t]\\)")) (defconst ledger-account-pending-regex "\\(^[ \t]+\\)\\(!\\s-*.*?\\)\\( \\|\t\\|$\\)") @@ -83,10 +83,10 @@ (defmacro ledger-define-regexp (name regex docs &rest args) "Simplify the creation of a Ledger regex and helper functions." (let ((defs - (list - `(defconst - ,(intern (concat "ledger-" (symbol-name name) "-regexp")) - ,(eval regex)))) + (list + `(defconst + ,(intern (concat "ledger-" (symbol-name name) "-regexp")) + ,(eval regex)))) (addend 0) last-group) (if (null args) (progn @@ -94,242 +94,268 @@ defs (list `(defconst - ,(intern - (concat "ledger-regex-" (symbol-name name) "-group")) + ,(intern + (concat "ledger-regex-" (symbol-name name) "-group")) 1))) (nconc defs (list `(defconst - ,(intern (concat "ledger-regex-" (symbol-name name) - "-group--count")) + ,(intern (concat "ledger-regex-" (symbol-name name) + "-group--count")) 1))) (nconc defs (list `(defmacro - ,(intern (concat "ledger-regex-" (symbol-name name))) - (&optional string) + ,(intern (concat "ledger-regex-" (symbol-name name))) + (&optional string) ,(format "Return the match string for the %s" name) (match-string ,(intern (concat "ledger-regex-" (symbol-name name) "-group")) string))))) - (dolist (arg args) - (let (var grouping target) - (if (symbolp arg) - (setq var arg target arg) - (assert (listp arg)) - (if (= 2 (length arg)) - (setq var (car arg) - target (cadr arg)) - (setq var (car arg) - grouping (cadr arg) - target (caddr arg)))) - - (if (and last-group - (not (eq last-group (or grouping target)))) - (incf addend - (symbol-value - (intern-soft (concat "ledger-regex-" - (symbol-name last-group) - "-group--count"))))) - (nconc - defs - (list - `(defconst - ,(intern (concat "ledger-regex-" (symbol-name name) - "-group-" (symbol-name var))) - ,(+ addend - (symbol-value - (intern-soft - (if grouping - (concat "ledger-regex-" (symbol-name grouping) - "-group-" (symbol-name target)) - (concat "ledger-regex-" (symbol-name target) - "-group")))))))) - (nconc - defs - (list - `(defmacro - ,(intern (concat "ledger-regex-" (symbol-name name) - "-" (symbol-name var))) - (&optional string) - ,(format "Return the sub-group match for the %s %s." - name var) - (match-string - ,(intern (concat "ledger-regex-" (symbol-name name) - "-group-" (symbol-name var))) - string)))) - - (setq last-group (or grouping target)))) - - (nconc defs - (list - `(defconst ,(intern (concat "ledger-regex-" (symbol-name name) - "-group--count")) - ,(length args))))) + (dolist (arg args) + (let (var grouping target) + (if (symbolp arg) + (setq var arg target arg) + (assert (listp arg)) + (if (= 2 (length arg)) + (setq var (car arg) + target (cadr arg)) + (setq var (car arg) + grouping (cadr arg) + target (caddr arg)))) + + (if (and last-group + (not (eq last-group (or grouping target)))) + (incf addend + (symbol-value + (intern-soft (concat "ledger-regex-" + (symbol-name last-group) + "-group--count"))))) + (nconc + defs + (list + `(defconst + ,(intern (concat "ledger-regex-" (symbol-name name) + "-group-" (symbol-name var))) + ,(+ addend + (symbol-value + (intern-soft + (if grouping + (concat "ledger-regex-" (symbol-name grouping) + "-group-" (symbol-name target)) + (concat "ledger-regex-" (symbol-name target) + "-group")))))))) + (nconc + defs + (list + `(defmacro + ,(intern (concat "ledger-regex-" (symbol-name name) + "-" (symbol-name var))) + (&optional string) + ,(format "Return the sub-group match for the %s %s." + name var) + (match-string + ,(intern (concat "ledger-regex-" (symbol-name name) + "-group-" (symbol-name var))) + string)))) + + (setq last-group (or grouping target)))) + + (nconc defs + (list + `(defconst ,(intern (concat "ledger-regex-" (symbol-name name) + "-group--count")) + ,(length args))))) (cons 'progn defs))) (put 'ledger-define-regexp 'lisp-indent-function 1) (ledger-define-regexp iso-date - ( let ((sep '(or ?- ?/))) - (rx (group - (and (group (? (= 4 num))) - (eval sep) - (group (and num (? num))) - (eval sep) - (group (and num (? num))))))) - "Match a single date, in its 'written' form.") + ( let ((sep '(or ?- ?/))) + (rx (group + (and (? (and (group (= 4 num))) + (eval sep)) + (group (and num (? num))) + (eval sep) + (group (and num (? num))))))) + "Match a single date, in its 'written' form.") (ledger-define-regexp full-date - (macroexpand - `(rx (and (regexp ,ledger-iso-date-regexp) - (? (and ?= (regexp ,ledger-iso-date-regexp)))))) - "Match a compound date, of the form ACTUAL=EFFECTIVE" - (actual iso-date) - (effective iso-date)) + (macroexpand + `(rx (and (regexp ,ledger-iso-date-regexp) + (? (and ?= (regexp ,ledger-iso-date-regexp)))))) + "Match a compound date, of the form ACTUAL=EFFECTIVE" + (actual iso-date) + (effective iso-date)) (ledger-define-regexp state - (rx (group (any ?! ?*))) - "Match a transaction or posting's \"state\" character.") + (rx (group (any ?! ?*))) + "Match a transaction or posting's \"state\" character.") (ledger-define-regexp code - (rx (and ?\( (group (+? (not (any ?\))))) ?\))) - "Match the transaction code.") + (rx (and ?\( (group (+? (not (any ?\))))) ?\))) + "Match the transaction code.") (ledger-define-regexp long-space - (rx (and (*? blank) - (or (and ? (or ? ?\t)) ?\t))) - "Match a \"long space\".") + (rx (and (*? blank) + (or (and ? (or ? ?\t)) ?\t))) + "Match a \"long space\".") (ledger-define-regexp note - (rx (group (+ nonl))) - "") + (rx (group (+ nonl))) + "") (ledger-define-regexp end-note - (macroexpand - `(rx (and (regexp ,ledger-long-space-regexp) ?\; - (regexp ,ledger-note-regexp)))) - "") + (macroexpand + `(rx (and (regexp ,ledger-long-space-regexp) ?\; + (regexp ,ledger-note-regexp)))) + "") (ledger-define-regexp full-note - (macroexpand - `(rx (and line-start (+ blank) - ?\; (regexp ,ledger-note-regexp)))) - "") + (macroexpand + `(rx (and line-start (+ blank) + ?\; (regexp ,ledger-note-regexp)))) + "") (ledger-define-regexp xact-line - (macroexpand - `(rx (and line-start - (regexp ,ledger-full-date-regexp) - (? (and (+ blank) (regexp ,ledger-state-regexp))) - (? (and (+ blank) (regexp ,ledger-code-regexp))) - (+ blank) (+? nonl) - (? (regexp ,ledger-end-note-regexp)) - line-end))) - "Match a transaction's first line (and optional notes)." - (actual-date full-date actual) - (effective-date full-date effective) - state - code - (note end-note)) + (macroexpand + `(rx (and line-start + (regexp ,ledger-full-date-regexp) + (? (and (+ blank) (regexp ,ledger-state-regexp))) + (? (and (+ blank) (regexp ,ledger-code-regexp))) + (+ blank) (+? nonl) + (? (regexp ,ledger-end-note-regexp)) + line-end))) + "Match a transaction's first line (and optional notes)." + (actual-date full-date actual) + (effective-date full-date effective) + state + code + (note end-note)) (ledger-define-regexp account - (rx (group (and (not (any blank ?\[ ?\( ?: ?\;)) (*? nonl)))) - "") + (rx (group (and (not (any blank ?\[ ?\( ?: ?\;)) (*? nonl)))) + "") (ledger-define-regexp account-kind - (rx (group (? (any ?\[ ?\()))) - "") + (rx (group (? (any ?\[ ?\()))) + "") (ledger-define-regexp full-account - (macroexpand - `(rx (and (regexp ,ledger-account-kind-regexp) - (regexp ,ledger-account-regexp) - (? (any ?\] ?\)))))) - "" - (kind account-kind) - (name account)) + (macroexpand + `(rx (and (regexp ,ledger-account-kind-regexp) + (regexp ,ledger-account-regexp) + (? (any ?\] ?\)))))) + "" + (kind account-kind) + (name account)) (ledger-define-regexp commodity - (rx (group - (or (and ?\" (+ (not (any ?\"))) ?\") - (not (any blank ?\n - digit - ?- ?\[ ?\] - ?. ?, ?\; ?+ ?* ?/ ?^ ?? ?: ?& ?| ?! ?= - ?\< ?\> ?\{ ?\} ?\( ?\) ?@))))) - "") + (rx (group + (or (and ?\" (+ (not (any ?\"))) ?\") + (not (any blank ?\n + digit + ?- ?\[ ?\] + ?. ?, ?\; ?+ ?* ?/ ?^ ?? ?: ?& ?| ?! ?= + ?\< ?\> ?\{ ?\} ?\( ?\) ?@))))) + "") (ledger-define-regexp amount - (rx (group - (and (? ?-) - (and (+ digit) - (*? (and (any ?. ?,) (+ digit)))) - (? (and (any ?. ?,) (+ digit)))))) - "") + (rx (group + (and (? ?-) + (and (+ digit) + (*? (and (any ?. ?,) (+ digit)))) + (? (and (any ?. ?,) (+ digit)))))) + "") (ledger-define-regexp commoditized-amount - (macroexpand - `(rx (group - (or (and (regexp ,ledger-commodity-regexp) - (*? blank) - (regexp ,ledger-amount-regexp)) - (and (regexp ,ledger-amount-regexp) - (*? blank) - (regexp ,ledger-commodity-regexp)))))) - "") + (macroexpand + `(rx (group + (or (and (regexp ,ledger-commodity-regexp) + (*? blank) + (regexp ,ledger-amount-regexp)) + (and (regexp ,ledger-amount-regexp) + (*? blank) + (regexp ,ledger-commodity-regexp)))))) + "") (ledger-define-regexp commodity-annotations - (macroexpand - `(rx (* (+ blank) - (or (and ?\{ (regexp ,ledger-commoditized-amount-regexp) ?\}) - (and ?\[ (regexp ,ledger-iso-date-regexp) ?\]) - (and ?\( (not (any ?\))) ?\)))))) - "") + (macroexpand + `(rx (* (+ blank) + (or (and ?\{ (regexp ,ledger-commoditized-amount-regexp) ?\}) + (and ?\[ (regexp ,ledger-iso-date-regexp) ?\]) + (and ?\( (not (any ?\))) ?\)))))) + "") (ledger-define-regexp cost - (macroexpand - `(rx (and (or "@" "@@") (+ blank) - (regexp ,ledger-commoditized-amount-regexp)))) - "") + (macroexpand + `(rx (and (or "@" "@@") (+ blank) + (regexp ,ledger-commoditized-amount-regexp)))) + "") (ledger-define-regexp balance-assertion - (macroexpand - `(rx (and ?= (+ blank) - (regexp ,ledger-commoditized-amount-regexp)))) - "") + (macroexpand + `(rx (and ?= (+ blank) + (regexp ,ledger-commoditized-amount-regexp)))) + "") (ledger-define-regexp full-amount - (macroexpand `(rx (group (+? (not (any ?\;)))))) - "") + (macroexpand `(rx (group (+? (not (any ?\;)))))) + "") (ledger-define-regexp post-line - (macroexpand - `(rx (and line-start (+ blank) - (? (and (regexp ,ledger-state-regexp) (* blank))) - (regexp ,ledger-full-account-regexp) - (? (and (regexp ,ledger-long-space-regexp) - (regexp ,ledger-full-amount-regexp))) - (? (regexp ,ledger-end-note-regexp)) - line-end))) - "" - state - (account-kind full-account kind) - (account full-account name) - (amount full-amount) - (note end-note)) + (macroexpand + `(rx (and line-start (+ blank) + (? (and (regexp ,ledger-state-regexp) (* blank))) + (regexp ,ledger-full-account-regexp) + (? (and (regexp ,ledger-long-space-regexp) + (regexp ,ledger-full-amount-regexp))) + (? (regexp ,ledger-end-note-regexp)) + line-end))) + "" + state + (account-kind full-account kind) + (account full-account name) + (amount full-amount) + (note end-note)) (defconst ledger-iterate-regex - (concat "\\(Y\\s-+\\([0-9]+\\)\\|" ;; Catches a Y directive - ledger-iso-date-regexp - "\\([ *!]+\\)" ;; mark - "\\((.*)\\)?" ;; code - "\\(.*\\)" ;; desc - "\\)")) + (concat "\\(\\(?:Y\\|year\\)\\s-+\\([0-9]+\\)\\|" ;; Catches a Y/year directive + ledger-iso-date-regexp + "\\([ *!]+\\)" ;; mark + "\\((.*)\\)?" ;; code + "\\([[:word:] ]+\\)" ;; desc + "\\)")) + +(defconst ledger-xact-start-regex + (concat "^" ledger-iso-date-regexp ;; subexp 1 + "\\(=" ledger-iso-date-regexp "\\)?" + )) + +(defconst ledger-xact-after-date-regex + (concat "\\([ \t]+[*!]\\)?" ;; mark, subexp 1 + "\\([ \t]+(.*?)\\)?" ;; code, subexp 2 + "\\([ \t]+[^;\n]+\\)" ;; desc, subexp 3 + "\\(;[^\n]*\\)?" ;; comment, subexp 4 + )) + +(defconst ledger-posting-regex + (concat "^[ \t]+ ?" ;; initial white space + "\\([*!]\\)? ?" ;; state, subexpr 1 + "\\([[:print:]]+\\([ \t][ \t]\\)\\)" ;; account, subexpr 2 + "\\([^;\n]*\\)" ;; amount, subexpr 4 + "\\(.*\\)" ;; comment, subexpr 5 + )) + + + +(defconst ledger-directive-start-regex + "[=~;#%|\\*[A-Za-z]") + (provide 'ledger-regex) diff --git a/lisp/ledger-report.el b/lisp/ledger-report.el index e785bc1b..c477707f 100644 --- a/lisp/ledger-report.el +++ b/lisp/ledger-report.el @@ -1,6 +1,6 @@ ;;; ledger-report.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. ;;; Commentary: @@ -25,6 +25,7 @@ ;;; Code: +(require 'easymenu) (eval-when-compile (require 'cl)) @@ -49,14 +50,15 @@ the substitution. See the documentation of the individual functions in that variable for more information on the behavior of each specifier." :type '(repeat (list (string :tag "Report Name") - (string :tag "Command Line"))) + (string :tag "Command Line"))) :group 'ledger-report) (defcustom ledger-report-format-specifiers '(("ledger-file" . ledger-report-ledger-file-format-specifier) ("payee" . ledger-report-payee-format-specifier) ("account" . ledger-report-account-format-specifier) - ("value" . ledger-report-value-format-specifier)) + ("tagname" . ledger-report-tagname-format-specifier) + ("tagvalue" . ledger-report-tagvalue-format-specifier)) "An alist mapping ledger report format specifiers to implementing functions. The function is called with no parameters and expected to return the @@ -64,6 +66,16 @@ text that should replace the format specifier." :type 'alist :group 'ledger-report) +(defcustom ledger-report-auto-refresh t + "If t then automatically rerun the report when the ledger buffer is saved." + :type 'boolean + :group 'ledger-report) + +(defcustom ledger-report-auto-refresh-sticky-cursor nil + "If t then try to place cursor at same relative position as it was before auto-refresh." + :type 'boolean + :group 'ledger-report) + (defvar ledger-report-buffer-name "*Ledger Report*") (defvar ledger-report-name nil) @@ -75,8 +87,16 @@ text that should replace the format specifier." (defvar ledger-minibuffer-history nil) (defvar ledger-report-mode-abbrev-table) +(defvar ledger-report-is-reversed nil) +(defvar ledger-report-cursor-line-number nil) + +(defun ledger-report-reverse-report () + "Reverse the order of the report." + (interactive) + (ledger-report-reverse-lines) + (setq ledger-report-is-reversed (not ledger-report-is-reversed))) + (defun ledger-report-reverse-lines () - (interactive) (goto-char (point-min)) (forward-paragraph) (forward-line) @@ -84,51 +104,61 @@ text that should replace the format specifier." (setq inhibit-read-only t) (reverse-region (point) (point-max)))) +(defvar ledger-report-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [? ] 'scroll-up) + (define-key map [backspace] 'scroll-down) + (define-key map [?r] 'ledger-report-redo) + (define-key map [(shift ?r)] 'ledger-report-reverse-report) + (define-key map [?s] 'ledger-report-save) + (define-key map [?k] 'ledger-report-kill) + (define-key map [?e] 'ledger-report-edit-report) + (define-key map [( shift ?e)] 'ledger-report-edit-reports) + (define-key map [?q] 'ledger-report-quit) + (define-key map [?g] 'ledger-report-redo) + (define-key map [(control ?c) (control ?l) (control ?r)] + 'ledger-report-redo) + (define-key map [(control ?c) (control ?l) (control ?S)] + 'ledger-report-save) + (define-key map [(control ?c) (control ?l) (control ?k)] + 'ledger-report-kill) + (define-key map [(control ?c) (control ?l) (control ?e)] + 'ledger-report-edit) + (define-key map [return] 'ledger-report-visit-source) + map) + "Keymap for `ledger-report-mode'.") + +(easy-menu-define ledger-report-mode-menu ledger-report-mode-map + "Ledger report menu" + '("Reports" + ["Save Report" ledger-report-save] + ["Edit Current Report" ledger-report-edit-report] + ["Edit All Reports" ledger-report-edit-reports] + ["Re-run Report" ledger-report-redo] + "---" + ["Reverse report order" ledger-report-reverse-report] + "---" + ["Scroll Up" scroll-up] + ["Visit Source" ledger-report-visit-source] + ["Scroll Down" scroll-down] + "---" + ["Quit" ledger-report-quit] + )) + (define-derived-mode ledger-report-mode text-mode "Ledger-Report" - "A mode for viewing ledger reports." - (let ((map (make-sparse-keymap))) - (define-key map [? ] 'scroll-up) - (define-key map [backspace] 'scroll-down) - (define-key map [?r] 'ledger-report-redo) - (define-key map [(shift ?r)] 'ledger-report-reverse-lines) - (define-key map [?s] 'ledger-report-save) - (define-key map [?k] 'ledger-report-kill) - (define-key map [?e] 'ledger-report-edit) - (define-key map [?q] 'ledger-report-quit) - (define-key map [(control ?c) (control ?l) (control ?r)] - 'ledger-report-redo) - (define-key map [(control ?c) (control ?l) (control ?S)] - 'ledger-report-save) - (define-key map [(control ?c) (control ?l) (control ?k)] - 'ledger-report-kill) - (define-key map [(control ?c) (control ?l) (control ?e)] - 'ledger-report-edit) - (define-key map [return] 'ledger-report-visit-source) - - - (define-key map [menu-bar] (make-sparse-keymap "ledger-rep")) - (define-key map [menu-bar ledger-rep] (cons "Reports" map)) - - (define-key map [menu-bar ledger-rep lrq] '("Quit" . ledger-report-quit)) - (define-key map [menu-bar ledger-rep s2] '("--")) - (define-key map [menu-bar ledger-rep lrd] '("Scroll Down" . scroll-down)) - (define-key map [menu-bar ledger-rep vis] '("Visit Source" . ledger-report-visit-source)) - (define-key map [menu-bar ledger-rep lru] '("Scroll Up" . scroll-up)) - (define-key map [menu-bar ledger-rep s1] '("--")) - (define-key map [menu-bar ledger-rep rev] '("Reverse report order" . ledger-report-reverse-lines)) - (define-key map [menu-bar ledger-rep s0] '("--")) - (define-key map [menu-bar ledger-rep lrk] '("Kill Report" . ledger-report-kill)) - (define-key map [menu-bar ledger-rep lrr] '("Re-run Report" . ledger-report-redo)) - (define-key map [menu-bar ledger-rep lre] '("Edit Report" . ledger-report-edit)) - (define-key map [menu-bar ledger-rep lrs] '("Save Report" . ledger-report-save)) - - (use-local-map map))) - -(defun ledger-report-value-format-specifier () + "A mode for viewing ledger reports.") + +(defun ledger-report-tagname-format-specifier () "Return a valid meta-data tag name" ;; It is intended completion should be available on existing account ;; names, but it remains to be implemented. - (ledger-read-string-with-default "Value: " nil)) + (ledger-read-string-with-default "Tag Name: " nil)) + +(defun ledger-report-tagvalue-format-specifier () + "Return a valid meta-data tag name" + ;; It is intended completion should be available on existing account + ;; names, but it remains to be implemented. + (ledger-read-string-with-default "Tag Value: " nil)) (defun ledger-report-read-name () "Read the name of a ledger report to use, with completion. @@ -173,13 +203,14 @@ used to generate the buffer, navigating the buffer, etc." (set (make-local-variable 'ledger-buf) buf) (set (make-local-variable 'ledger-report-name) report-name) (set (make-local-variable 'ledger-original-window-cfg) wcfg) + (set (make-local-variable 'ledger-report-is-reversed) nil) (ledger-do-report (ledger-report-cmd report-name edit)) (shrink-window-if-larger-than-buffer) (set-buffer-modified-p nil) (setq buffer-read-only t) (message "q to quit; r to redo; e to edit; k to kill; s to save; SPC and DEL to scroll")))) -(defun string-empty-p (s) +(defun ledger-report-string-empty-p (s) "Check S for the empty string." (string-equal "" s)) @@ -188,7 +219,7 @@ used to generate the buffer, navigating the buffer, etc." If name exists, returns the object naming the report, otherwise returns nil." - (unless (string-empty-p name) + (unless (ledger-report-string-empty-p name) (car (assoc name ledger-reports)))) (defun ledger-reports-add (name cmd) @@ -227,7 +258,7 @@ used to generate the buffer, navigating the buffer, etc." end of a ledger file which is included in some other file." (if ledger-master-file (expand-file-name ledger-master-file) - (buffer-file-name))) + (buffer-file-name))) (defun ledger-report-payee-format-specifier () "Substitute a payee name. @@ -257,16 +288,16 @@ used to generate the buffer, navigating the buffer, etc." (let ((expanded-cmd report-cmd)) (set-match-data (list 0 0)) (while (string-match "%(\\([^)]*\\))" expanded-cmd (if (> (length expanded-cmd) (match-end 0)) - (match-end 0) - (1- (length expanded-cmd)))) - (let* ((specifier (match-string 1 expanded-cmd)) - (f (cdr (assoc specifier ledger-report-format-specifiers)))) - (if f - (setq expanded-cmd (replace-match - (save-match-data - (with-current-buffer ledger-buf - (shell-quote-argument (funcall f)))) - t t expanded-cmd))))) + (match-end 0) + (1- (length expanded-cmd)))) + (let* ((specifier (match-string 1 expanded-cmd)) + (f (cdr (assoc specifier ledger-report-format-specifiers)))) + (if f + (setq expanded-cmd (replace-match + (save-match-data + (with-current-buffer ledger-buf + (shell-quote-argument (funcall f)))) + t t expanded-cmd))))) expanded-cmd))) (defun ledger-report-cmd (report-name edit) @@ -279,11 +310,11 @@ Optional EDIT the command." (setq ledger-report-saved nil)) ;; this is a new report, or edited report (setq report-cmd (ledger-report-expand-format-specifiers report-cmd)) (set (make-local-variable 'ledger-report-cmd) report-cmd) - (or (string-empty-p report-name) + (or (ledger-report-string-empty-p report-name) (ledger-report-name-exists report-name) (progn - (ledger-reports-add report-name report-cmd) - (ledger-reports-custom-save))) + (ledger-reports-add report-name report-cmd) + (ledger-reports-custom-save))) report-cmd)) (defun ledger-do-report (cmd) @@ -295,32 +326,32 @@ Optional EDIT the command." "\n\n") (let ((data-pos (point)) (register-report (string-match " reg\\(ister\\)? " cmd)) - files-in-report) + files-in-report) (shell-command ;; --subtotal does not produce identifiable transactions, so don't ;; prepend location information for them (if (and register-report - (not (string-match "--subtotal" cmd))) - (concat cmd " --prepend-format='%(filename):%(beg_line):'") - cmd) + (not (string-match "--subtotal" cmd))) + (concat cmd " --prepend-format='%(filename):%(beg_line):'") + cmd) t nil) (when register-report (goto-char data-pos) (while (re-search-forward "^\\(/[^:]+\\)?:\\([0-9]+\\)?:" nil t) - (let ((file (match-string 1)) - (line (string-to-number (match-string 2)))) - (delete-region (match-beginning 0) (match-end 0)) - (when file - (set-text-properties (line-beginning-position) (line-end-position) - (list 'ledger-source (cons file (save-window-excursion - (save-excursion - (find-file file) - (widen) - (ledger-goto-line line) - (point-marker)))))) - (add-text-properties (line-beginning-position) (line-end-position) - (list 'face 'ledger-font-report-clickable-face)) - (end-of-line))))) + (let ((file (match-string 1)) + (line (string-to-number (match-string 2)))) + (delete-region (match-beginning 0) (match-end 0)) + (when file + (set-text-properties (line-beginning-position) (line-end-position) + (list 'ledger-source (cons file (save-window-excursion + (save-excursion + (find-file file) + (widen) + (ledger-navigate-to-line line) + (point-marker)))))) + (add-text-properties (line-beginning-position) (line-end-position) + (list 'face 'ledger-font-report-clickable-face)) + (end-of-line))))) (goto-char data-pos))) @@ -328,21 +359,21 @@ Optional EDIT the command." "Visit the transaction under point in the report window." (interactive) (let* ((prop (get-text-property (point) 'ledger-source)) - (file (if prop (car prop))) - (line-or-marker (if prop (cdr prop)))) + (file (if prop (car prop))) + (line-or-marker (if prop (cdr prop)))) (when (and file line-or-marker) (find-file-other-window file) (widen) (if (markerp line-or-marker) - (goto-char line-or-marker) - (goto-char (point-min)) - (forward-line (1- line-or-marker)) - (re-search-backward "^[0-9]+") - (beginning-of-line) - (let ((start-of-txn (point))) - (forward-paragraph) - (narrow-to-region start-of-txn (point)) - (backward-paragraph)))))) + (goto-char line-or-marker) + (goto-char (point-min)) + (forward-line (1- line-or-marker)) + (re-search-backward "^[0-9]+") + (beginning-of-line) + (let ((start-of-txn (point))) + (forward-paragraph) + (narrow-to-region start-of-txn (point)) + (backward-paragraph)))))) (defun ledger-report-goto () "Goto the ledger report buffer." @@ -356,34 +387,46 @@ Optional EDIT the command." (defun ledger-report-redo () "Redo the report in the current ledger report buffer." (interactive) - (ledger-report-goto) - (setq buffer-read-only nil) - (erase-buffer) - (ledger-do-report ledger-report-cmd) - (setq buffer-read-only nil)) + (let ((cur-buf (current-buffer))) + (if (and ledger-report-auto-refresh + (or (string= (format-mode-line 'mode-name) "Ledger") + (string= (format-mode-line 'mode-name) "Ledger-Report")) + (get-buffer ledger-report-buffer-name)) + (progn + + (pop-to-buffer (get-buffer ledger-report-buffer-name)) + (shrink-window-if-larger-than-buffer) + (setq buffer-read-only nil) + (setq ledger-report-cursor-line-number (line-number-at-pos)) + (erase-buffer) + (ledger-do-report ledger-report-cmd) + (setq buffer-read-only nil) + (if ledger-report-is-reversed (ledger-report-reverse-lines)) + (if ledger-report-auto-refresh-sticky-cursor (forward-line (- ledger-report-cursor-line-number 5))) + (pop-to-buffer cur-buf))))) (defun ledger-report-quit () - "Quit the ledger report buffer by burying it." - (interactive) - (ledger-report-goto) - (set-window-configuration ledger-original-window-cfg) - (bury-buffer (get-buffer ledger-report-buffer-name))) - -(defun ledger-report-kill () - "Kill the ledger report buffer." - (interactive) - (ledger-report-quit) - (kill-buffer (get-buffer ledger-report-buffer-name))) + "Quit the ledger report buffer." + (interactive) + (ledger-report-goto) + (set-window-configuration ledger-original-window-cfg) + (kill-buffer (get-buffer ledger-report-buffer-name))) -(defun ledger-report-edit () +(defun ledger-report-edit-reports () "Edit the defined ledger reports." (interactive) (customize-variable 'ledger-reports)) +(defun ledger-report-edit-report () + (interactive) + "Edit the current report command in the mini buffer and re-run the report" + (setq ledger-report-cmd (ledger-report-read-command ledger-report-cmd)) + (ledger-report-redo)) + (defun ledger-report-read-new-name () "Read the name for a new report from the minibuffer." (let ((name "")) - (while (string-empty-p name) + (while (ledger-report-string-empty-p name) (setq name (read-from-minibuffer "Report name: " nil nil nil 'ledger-report-name-prompt-history))) name)) @@ -393,26 +436,26 @@ Optional EDIT the command." (interactive) (ledger-report-goto) (let (existing-name) - (when (string-empty-p ledger-report-name) + (when (ledger-report-string-empty-p ledger-report-name) (setq ledger-report-name (ledger-report-read-new-name))) (if (setq existing-name (ledger-report-name-exists ledger-report-name)) - (cond ((y-or-n-p (format "Overwrite existing report named '%s'? " - ledger-report-name)) - (if (string-equal - ledger-report-cmd - (car (cdr (assq existing-name ledger-reports)))) - (message "Nothing to save. Current command is identical to existing saved one") - (progn - (setq ledger-reports - (assq-delete-all existing-name ledger-reports)) - (ledger-reports-add ledger-report-name ledger-report-cmd) - (ledger-reports-custom-save)))) - (t - (progn - (setq ledger-report-name (ledger-report-read-new-name)) - (ledger-reports-add ledger-report-name ledger-report-cmd) - (ledger-reports-custom-save))))))) + (cond ((y-or-n-p (format "Overwrite existing report named '%s'? " + ledger-report-name)) + (if (string-equal + ledger-report-cmd + (car (cdr (assq existing-name ledger-reports)))) + (message "Nothing to save. Current command is identical to existing saved one") + (progn + (setq ledger-reports + (assq-delete-all existing-name ledger-reports)) + (ledger-reports-add ledger-report-name ledger-report-cmd) + (ledger-reports-custom-save)))) + (t + (progn + (setq ledger-report-name (ledger-report-read-new-name)) + (ledger-reports-add ledger-report-name ledger-report-cmd) + (ledger-reports-custom-save))))))) (provide 'ledger-report) diff --git a/lisp/ledger-schedule.el b/lisp/ledger-schedule.el index 7497c7d0..d66fdbab 100644 --- a/lisp/ledger-schedule.el +++ b/lisp/ledger-schedule.el @@ -16,13 +16,13 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. ;;; Commentary: ;; ;; This module provides for automatically adding transactions to a -;; ledger buffer on a periodic basis. Recurrence expressions are +;; ledger buffer on a periodic basis. Recurrence expressions are ;; inspired by Martin Fowler's "Recurring Events for Calendars", ;; martinfowler.com/apsupp/recurring.pdf @@ -30,12 +30,17 @@ ;; function slot of the symbol VARNAME. Then use VARNAME as the ;; function without have to use funcall. +(require 'ledger-init) +(require 'cl) + +;;; Code: + (defgroup ledger-schedule nil "Support for automatically recommendation transactions." :group 'ledger) (defcustom ledger-schedule-buffer-name "*Ledger Schedule*" - "Name for the schedule buffer" + "Name for the schedule buffer." :type 'string :group 'ledger-schedule) @@ -45,284 +50,276 @@ :group 'ledger-schedule) (defcustom ledger-schedule-look-forward 14 - "Number of days auto look forward to recommend transactions" + "Number of days auto look forward to recommend transactions." :type 'integer :group 'ledger-schedule) -(defcustom ledger-schedule-file "~/FinanceData/ledger-schedule.ledger" +(defcustom ledger-schedule-file "~/ledger-schedule.ledger" "File to find scheduled transactions." :type 'file :group 'ledger-schedule) +(defcustom ledger-schedule-week-days '(("Mo" 1) + ("Tu" 2) + ("We" 3) + ("Th" 4) + ("Fr" 5) + ("Sa" 6) + ("Su" 7)) + "List of weekday abbreviations. There must be exactly seven +entries each with a two character abbreviation for a day and the +number of that day in the week. " + :type '(alist :value-type (group integer)) + :group 'ledger-schedule) + (defsubst between (val low high) - (and (>= val low) (<= val high))) + "Return TRUE if VAL > LOW and < HIGH." + (and (>= val low) (<= val high))) (defun ledger-schedule-days-in-month (month year) "Return number of days in the MONTH, MONTH is from 1 to 12. -If year is nil, assume it is not a leap year" +If YEAR is nil, assume it is not a leap year" (if (between month 1 12) (if (and year (date-leap-year-p year) (= 2 month)) - 29 - (nth (1- month) '(31 28 31 30 31 30 31 31 30 31 30 31))) - (error "Month out of range, MONTH=%S" month))) + 29 + (nth (1- month) '(31 28 31 30 31 30 31 31 30 31 30 31))) + (error "Month out of range, MONTH=%S" month))) + +(defun ledger-schedule-encode-day-of-week (day-string) + "Return the numerical day of week corresponding to DAY-STRING." + (cadr (assoc day-string ledger-schedule-week-days))) ;; Macros to handle date expressions (defun ledger-schedule-constrain-day-in-month (count day-of-week) - "Return a form that evaluates DATE that returns true for the COUNT DAY-OF-WEEK. + "Return a form that returns TRUE for the the COUNT DAY-OF-WEEK. For example, return true if date is the 3rd Thursday of the month. Negative COUNT starts from the end of the month. (EQ COUNT 0) means EVERY day-of-week (eg. every Saturday)" (if (and (between count -6 6) (between day-of-week 0 6)) (cond ((zerop count) ;; Return true if day-of-week matches - `(eq (nth 6 (decode-time date)) ,day-of-week)) - ((> count 0) ;; Positive count - (let ((decoded (gensym))) - `(let ((,decoded (decode-time date))) - (and (eq (nth 6 ,decoded) ,day-of-week) - (between (nth 3 ,decoded) - ,(* (1- count) 7) - ,(* count 7)))))) - ((< count 0) - (let ((days-in-month (gensym)) - (decoded (gensym))) - `(let* ((,decoded (decode-time date)) - (,days-in-month (ledger-schedule-days-in-month - (nth 4 ,decoded) - (nth 5 ,decoded)))) - (and (eq (nth 6 ,decoded) ,day-of-week) - (between (nth 3 ,decoded) - (+ ,days-in-month ,(* count 7)) - (+ ,days-in-month ,(* (1+ count) 7))))))) - (t - (error "COUNT out of range, COUNT=%S" count))) - (error "Invalid argument to ledger-schedule-day-in-month-macro %S %S" - count - day-of-week))) + `(eq (nth 6 (decode-time date)) ,day-of-week)) + ((> count 0) ;; Positive count + (let ((decoded (gensym))) + `(let ((,decoded (decode-time date))) + (and (eq (nth 6 ,decoded) ,day-of-week) + (between (nth 3 ,decoded) + ,(* (1- count) 7) + ,(* count 7)))))) + ((< count 0) + (let ((days-in-month (gensym)) + (decoded (gensym))) + `(let* ((,decoded (decode-time date)) + (,days-in-month (ledger-schedule-days-in-month + (nth 4 ,decoded) + (nth 5 ,decoded)))) + (and (eq (nth 6 ,decoded) ,day-of-week) + (between (nth 3 ,decoded) + (+ ,days-in-month ,(* count 7)) + (+ ,days-in-month ,(* (1+ count) 7))))))) + (t + (error "COUNT out of range, COUNT=%S" count))) + (error "Invalid argument to ledger-schedule-day-in-month-macro %S %S" + count + day-of-week))) (defun ledger-schedule-constrain-every-count-day (day-of-week skip start-date) - "Return a form that is true for every DAY skipping SKIP, starting on START. + "Return a form that is true for every DAY-OF-WEEK skipping SKIP, starting on START-DATE. For example every second Friday, regardless of month." - (let ((start-day (nth 6 (decode-time (eval start-date))))) - (if (eq start-day day-of-week) ;; good, can proceed - `(zerop (mod (- (time-to-days date) ,(time-to-days (eval start-date))) ,(* skip 7))) - (error "START-DATE day of week doesn't match DAY-OF-WEEK")))) + (let ((start-day (nth 6 (decode-time start-date)))) + (if (eq start-day day-of-week) ;; good, can proceed + `(zerop (mod (- (time-to-days date) ,(time-to-days start-date)) ,(* skip 7))) + (error "START-DATE day of week doesn't match DAY-OF-WEEK")))) (defun ledger-schedule-constrain-date-range (month1 day1 month2 day2) "Return a form of DATE that is true if DATE falls between MONTH1 DAY1 and MONTH2 DAY2." (let ((decoded (gensym)) - (target-month (gensym)) - (target-day (gensym))) + (target-month (gensym)) + (target-day (gensym))) `(let* ((,decoded (decode-time date)) - (,target-month (nth 4 decoded)) - (,target-day (nth 3 decoded))) + (,target-month (nth 4 decoded)) + (,target-day (nth 3 decoded))) (and (and (> ,target-month ,month1) - (< ,target-month ,month2)) - (and (> ,target-day ,day1) - (< ,target-day ,day2)))))) + (< ,target-month ,month2)) + (and (> ,target-day ,day1) + (< ,target-day ,day2)))))) -(defun ledger-schedule-is-holiday (date) - "Return true if DATE is a holiday.") (defun ledger-schedule-scan-transactions (schedule-file) - "Scans AUTO_FILE and returns a list of transactions with date predicates. -The car of each item is a fuction of date that returns true if + "Scan SCHEDULE-FILE and return a list of transactions with date predicates. +The car of each item is a function of date that returns true if the transaction should be logged for that day." (interactive "fFile name: ") (let ((xact-list (list))) (with-current-buffer - (find-file-noselect schedule-file) + (find-file-noselect schedule-file) (goto-char (point-min)) (while (re-search-forward "^\\[\\(.*\\)\\] " nil t) - (let ((date-descriptor "") - (transaction nil) - (xact-start (match-end 0))) - (setq date-descriptors - (ledger-schedule-read-descriptor-tree - (buffer-substring-no-properties - (match-beginning 0) - (match-end 0)))) - (forward-paragraph) - (setq transaction (list date-descriptors - (buffer-substring-no-properties - xact-start - (point)))) - (setq xact-list (cons transaction xact-list)))) - xact-list))) - -(defun ledger-schedule-replace-brackets () - "Replace all brackets with parens" - (goto-char (point-min)) - (while (search-forward "]" nil t) - (replace-match ")" nil t)) - (goto-char (point-min)) - (while (search-forward "[" nil t) - (replace-match "(" nil t))) - -(defvar ledger-schedule-descriptor-regex - (concat "\\(20[0-9][0-9]\\|[\*]\\)[/\\-]" ;; Year slot - "\\([\*EO]\\|[01][0-9]\\)[/\\-]" ;; Month slot - "\\([\*]\\|\\([0-3][0-9]\\)\\|" - "\\([0-5]" - "\\(\\(Su\\)\\|" - "\\(Mo\\)\\|" - "\\(Tu\\)\\|" - "\\(We\\)\\|" - "\\(Th\\)\\|" - "\\(Fr\\)\\|" - "\\(Sa\\)\\)\\)\\)")) + (let ((date-descriptor "") + (transaction nil) + (xact-start (match-end 0))) + (setq date-descriptor + (ledger-schedule-read-descriptor-tree + (buffer-substring-no-properties + (match-beginning 0) + (match-end 0)))) + (forward-paragraph) + (setq transaction (list date-descriptor + (buffer-substring-no-properties + xact-start + (point)))) + (setq xact-list (cons transaction xact-list)))) + xact-list))) (defun ledger-schedule-read-descriptor-tree (descriptor-string) - "Take a date DESCRIPTOR-STRING and return a function of date that -returns true if the date meets the requirements" - (with-temp-buffer - ;; copy the descriptor string into a temp buffer for manipulation - (let (pos) - ;; Replace brackets with parens - (insert descriptor-string) - (ledger-schedule-replace-brackets) - - (goto-char (point-max)) - ;; double quote all the descriptors for string processing later - (while (re-search-backward ledger-schedule-descriptor-regex nil t) ;; Day slot - (goto-char - (match-end 0)) - (insert ?\") - (goto-char (match-beginning 0)) - (insert "\"" ))) - - ;; read the descriptor string into a lisp object the transform the - ;; string descriptor into useable things - (ledger-schedule-transform-auto-tree - (read (buffer-substring-no-properties (point-min) (point-max)))))) + "Read DESCRIPTOR-STRING and return a form that evaluates dates." + (ledger-schedule-transform-auto-tree + (split-string + (substring descriptor-string 1 (string-match "]" descriptor-string)) " "))) (defun ledger-schedule-transform-auto-tree (descriptor-string-list) -"Takes a lisp list of date descriptor strings, TREE, and returns a string with a lambda function of date." -;; use funcall to use the lambda function spit out here + "Take DESCRIPTOR-STRING-LIST, and return a string with a lambda function of date." + ;; use funcall to use the lambda function spit out here (if (consp descriptor-string-list) (let (result) - (while (consp descriptor-string-list) - (let ((newcar (car descriptor-string-list))) - (if (consp newcar) - (setq newcar (ledger-schedule-transform-auto-tree (car descriptor-string-list)))) - ;; newcar may be a cons now, after ledger-schedule-transfrom-auto-tree - (if (consp newcar) - (push newcar result) - ;; this is where we actually turn the string descriptor into useful lisp - (push (ledger-schedule-compile-constraints newcar) result)) ) - (setq descriptor-string-list (cdr descriptor-string-list))) - - ;; tie up all the clauses in a big or and lambda, and return - ;; the lambda function as list to be executed by funcall - `(lambda (date) - ,(nconc (list 'or) (nreverse result) descriptor-string-list))))) + (while (consp descriptor-string-list) + (let ((newcar (car descriptor-string-list))) + (if (consp newcar) + (setq newcar (ledger-schedule-transform-auto-tree (car descriptor-string-list)))) + ;; newcar may be a cons now, after ledger-schedule-transfrom-auto-tree + (if (consp newcar) + (push newcar result) + ;; this is where we actually turn the string descriptor into useful lisp + (push (ledger-schedule-compile-constraints newcar) result)) ) + (setq descriptor-string-list (cdr descriptor-string-list))) + + ;; tie up all the clauses in a big or lambda, and return + ;; the lambda function as list to be executed by funcall + `(lambda (date) + ,(nconc (list 'or) (nreverse result) descriptor-string-list))))) (defun ledger-schedule-compile-constraints (descriptor-string) - "Return a list with the year, month and day fields split" - (let ((fields (split-string descriptor-string "[/\\-]" t)) - constrain-year constrain-month constrain-day) - (setq constrain-year (ledger-schedule-constrain-year (nth 0 fields))) - (setq constrain-month (ledger-schedule-constrain-month (nth 1 fields))) - (setq constrain-day (ledger-schedule-constrain-day (nth 2 fields))) - - (list 'and constrain-year constrain-month constrain-day))) - -(defun ledger-schedule-constrain-year (str) - (let ((year-match t)) - (cond ((string= str "*") - year-match) - ((/= 0 (setq year-match (string-to-number str))) - `(eq (nth 5 (decode-time date)) ,year-match)) - (t - (error "Improperly specified year constraint: " str))))) - -(defun ledger-schedule-constrain-month (str) - - (let ((month-match t)) - (cond ((string= str "*") - month-match) ;; always match - ((/= 0 (setq month-match (string-to-number str))) - (if (between month-match 1 12) ;; no month specified, assume 31 days. - `(eq (nth 4 (decode-time date)) ,month-match) - (error "ledger-schedule-constrain-numerical-month: month out of range %S" month-match))) - (t - (error "Improperly specified month constraint: " str))))) - -(defun ledger-schedule-constrain-day (str) - (let ((day-match t)) - (cond ((string= str "*") - t) - ((/= 0 (setq day-match (string-to-number str))) - `(eq (nth 3 (decode-time date)) ,day-match)) - (t - (error "Improperly specified day constraint: " str))))) - -(defun ledger-schedule-parse-date-descriptor (descriptor) - "Parse the date descriptor, return the evaluator" - (ledger-schedule-compile-constraints descriptor)) + "Return a list with the year, month and day fields split." + (let ((fields (split-string descriptor-string "[/\\-]" t))) + (if (string-match "[A-Za-z]" descriptor-string) + (ledger-schedule-constrain-day (nth 0 fields) (nth 1 fields) (nth 2 fields)) + (list 'and + (ledger-schedule-constrain-day (nth 0 fields) (nth 1 fields) (nth 2 fields)) + (ledger-schedule-constrain-year (nth 0 fields) (nth 1 fields) (nth 2 fields)) + (ledger-schedule-constrain-month (nth 0 fields) (nth 1 fields) (nth 2 fields)))))) + +(defun ledger-schedule-constrain-year (year-desc month-desc day-desc) + "Return a form that constrains the year. + +YEAR-DESC, MONT-DESC, and DAY-DESC are the string portions of the +date descriptor." + (cond ((string= year-desc "*") t) + ((/= 0 (string-to-number year-desc)) + `(memq (nth 5 (decode-time date)) ',(mapcar 'string-to-number (split-string year-desc ",")))) + (t + (error "Improperly specified year constraint: %s %s %s" year-desc month-desc day-desc)))) + +(defun ledger-schedule-constrain-month (year-desc month-desc day-desc) + "Return a form that constrains the month. + +YEAR-DESC, MONT-DESC, and DAY-DESC are the string portions of the +date descriptor." + (cond ((string= month-desc "*") + t) ;; always match + ((string= month-desc "E") ;; Even + `(evenp (nth 4 (decode-time date)))) + ((string= month-desc "O") ;; Odd + `(oddp (nth 4 (decode-time date)))) + ((/= 0 (string-to-number month-desc)) ;; Starts with number + `(memq (nth 4 (decode-time date)) ',(mapcar 'string-to-number (split-string month-desc ",")))) + (t + (error "Improperly specified month constraint: %s %s %s" year-desc month-desc day-desc)))) + +(defun ledger-schedule-constrain-day (year-desc month-desc day-desc) + "Return a form that constrains the day. + +YEAR-DESC, MONT-DESC, and DAY-DESC are the string portions of the +date descriptor." + (cond ((string= day-desc "*") + t) + ((string-match "[A-Za-z]" day-desc) ;; There is something other than digits and commas + (ledger-schedule-parse-complex-date year-desc month-desc day-desc)) + ((/= 0 (string-to-number day-desc)) + `(memq (nth 3 (decode-time date)) ',(mapcar 'string-to-number (split-string day-desc ",")))) + (t + (error "Improperly specified day constraint: %s %s %s" year-desc month-desc day-desc)))) + + + +(defun ledger-schedule-parse-complex-date (year-desc month-desc day-desc) + "Parse day descriptors that have repeats." + (let ((years (mapcar 'string-to-number (split-string year-desc ","))) + (months (mapcar 'string-to-number (split-string month-desc ","))) + (day-parts (split-string day-desc "+")) + (every-nth (string-match "+" day-desc))) + (if every-nth + (let ((base-day (string-to-number (car day-parts))) + (increment (string-to-number (substring (cadr day-parts) 0 + (string-match "[A-Za-z]" (cadr day-parts))))) + (day-of-week (ledger-schedule-encode-day-of-week + (substring (cadr day-parts) (string-match "[A-Za-z]" (cadr day-parts)))))) + (ledger-schedule-constrain-every-count-day day-of-week increment (encode-time 0 0 0 base-day (car months) (car years)))) + (let ((count (string-to-number (substring (car day-parts) 0 1))) + (day-of-week (ledger-schedule-encode-day-of-week + (substring (car day-parts) (string-match "[A-Za-z]" (car day-parts)))))) + (ledger-schedule-constrain-day-in-month count day-of-week))))) (defun ledger-schedule-list-upcoming-xacts (candidate-items early horizon) - "Search CANDIDATE-ITEMS for xacts that occur within the period today - EARLY to today + HORIZON" - (let ((start-date (time-subtract (current-time) (days-to-time early))) - test-date items) - (loop for day from 0 to (+ early horizon) by 1 do - (setq test-date (time-add start-date (days-to-time day))) - (dolist (candidate candidate-items items) - (if (funcall (car candidate) test-date) - (setq items (append items (list (list test-date (cadr candidate)))))))) - items)) - -(defun ledger-schedule-already-entered (candidate buffer) - (let ((target-date (format-time-string date-format (car candidate))) - (target-payee (cadr candidate))) - nil)) + "Search CANDIDATE-ITEMS for xacts that occur within the period today - EARLY to today + HORIZON." + (let ((start-date (time-subtract (current-time) (days-to-time early))) + test-date items) + (loop for day from 0 to (+ early horizon) by 1 do + (setq test-date (time-add start-date (days-to-time day))) + (dolist (candidate candidate-items items) + (if (funcall (car candidate) test-date) + (setq items (append items (list (list test-date (cadr candidate)))))))) + items)) (defun ledger-schedule-create-auto-buffer (candidate-items early horizon ledger-buf) "Format CANDIDATE-ITEMS for display." (let ((candidates (ledger-schedule-list-upcoming-xacts candidate-items early horizon)) - (schedule-buf (get-buffer-create ledger-schedule-buffer-name)) - (date-format (cdr (assoc "date-format" ledger-environment-alist)))) + (schedule-buf (get-buffer-create ledger-schedule-buffer-name)) + (date-format (or (cdr (assoc "date-format" ledger-environment-alist)) + ledger-default-date-format))) (with-current-buffer schedule-buf (erase-buffer) - (dolist (candidate candidates) - (if (not (ledger-schedule-already-entered candidate ledger-buf)) - (insert (format-time-string date-format (car candidate) ) " " (cadr candidate) "\n"))) - (ledger-mode)) + (dolist (candidate candidates) + (insert (format-time-string date-format (car candidate) ) " " (cadr candidate) "\n")) + (ledger-mode)) (length candidates))) - -;; -;; Test harnesses for use in ielm -;; -(defvar auto-items) - -(defun ledger-schedule-test ( early horizon) - (ledger-schedule-create-auto-buffer - (ledger-schedule-scan-transactions ledger-schedule-file) - early - horizon - (get-buffer "2013.ledger"))) - - -(defun ledger-schedule-test-predict () - (let ((today (current-time)) - test-date items) - - (loop for day from 0 to ledger-schedule-look-forward by 1 do - (setq test-date (time-add today (days-to-time day))) - (dolist (item auto-items items) - (if (funcall (car item) test-date) - (setq items (append items (list (decode-time test-date) (cdr item))))))) - items)) - -(defun ledger-schedule-upcoming () - (interactive) - (ledger-schedule-create-auto-buffer - (ledger-schedule-scan-transactions ledger-schedule-file) - ledger-schedule-look-backward - ledger-schedule-look-forward - (current-buffer))) +(defun ledger-schedule-upcoming (file look-backward look-forward) + "Generate upcoming transactions. + +FILE is the file containing the scheduled transaction, +default to `ledger-schedule-file'. +LOOK-BACKWARD is the number of day in the past to look at +default to `ledger-schedule-look-backward' +LOOK-FORWARD is the number of day in the futur to look at +default to `ledger-schedule-look-forward' + +Use a prefix arg to change the default value" + (interactive (if current-prefix-arg + (list (read-file-name "Schedule File: " () ledger-schedule-file t) + (read-number "Look backward: " ledger-schedule-look-backward) + (read-number "Look forward: " ledger-schedule-look-forward)) + (list ledger-schedule-file ledger-schedule-look-backward ledger-schedule-look-forward))) + (if (and file + (file-exists-p file)) + (progn + (ledger-schedule-create-auto-buffer + (ledger-schedule-scan-transactions file) + look-backward + look-forward + (current-buffer)) + (pop-to-buffer ledger-schedule-buffer-name)) + (error "Could not find ledger schedule file at %s" file))) (provide 'ledger-schedule) diff --git a/lisp/ledger-sort.el b/lisp/ledger-sort.el index c5a41952..870e298c 100644 --- a/lisp/ledger-sort.el +++ b/lisp/ledger-sort.el @@ -1,6 +1,6 @@ ;;; ledger-xact.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. @@ -26,39 +26,34 @@ ;;; Code: -(defun ledger-next-record-function () - "Move point to next transaction." - (if (re-search-forward ledger-payee-any-status-regex nil t) - (goto-char (match-beginning 0)) - (goto-char (point-max)))) - -(defun ledger-end-record-function () - "Move point to end of transaction." - (forward-paragraph)) (defun ledger-sort-find-start () + "Find the beginning of a sort region" (if (re-search-forward ";.*Ledger-mode:.*Start sort" nil t) (match-end 0))) (defun ledger-sort-find-end () + "Find the end of a sort region" (if (re-search-forward ";.*Ledger-mode:.*End sort" nil t) (match-end 0))) (defun ledger-sort-insert-start-mark () + "Insert a marker to start a sort region" (interactive) (save-excursion (goto-char (point-min)) (if (ledger-sort-find-start) - (delete-region (match-beginning 0) (match-end 0)))) + (delete-region (match-beginning 0) (match-end 0)))) (beginning-of-line) (insert "\n; Ledger-mode: Start sort\n\n")) (defun ledger-sort-insert-end-mark () + "Insert a marker to end a sort region" (interactive) (save-excursion (goto-char (point-min)) (if (ledger-sort-find-end) - (delete-region (match-beginning 0) (match-end 0)))) + (delete-region (match-beginning 0) (match-end 0)))) (beginning-of-line) (insert "\n; Ledger-mode: End sort\n\n")) @@ -69,57 +64,59 @@ (defun ledger-sort-region (beg end) "Sort the region from BEG to END in chronological order." (interactive "r") ;; load beg and end from point and mark - ;; automagically + ;; automagically (let ((new-beg beg) - (new-end end) - point-delta - (bounds (ledger-find-xact-extents (point))) - target-xact) - - (setq point-delta (- (point) (car bounds))) - (setq target-xact (buffer-substring (car bounds) (cadr bounds))) - (setq inhibit-modification-hooks t) + (new-end end) + point-delta + (bounds (ledger-navigate-find-xact-extents (point))) + target-xact) + + (setq point-delta (- (point) (car bounds))) + (setq target-xact (buffer-substring (car bounds) (cadr bounds))) + (setq inhibit-modification-hooks t) (save-excursion (save-restriction - (goto-char beg) - (ledger-next-record-function) ;; make sure point is at the - ;; beginning of a xact - (setq new-beg (point)) - (goto-char end) - (ledger-next-record-function) ;; make sure end of region is at - ;; the beginning of next record - ;; after the region - (setq new-end (point)) - (narrow-to-region new-beg new-end) - (goto-char new-beg) - - (let ((inhibit-field-text-motion t)) - (sort-subr - nil - 'ledger-next-record-function - 'ledger-end-record-function - 'ledger-sort-startkey)))) - - (goto-char (point-min)) - (re-search-forward (regexp-quote target-xact)) - (goto-char (+ (match-beginning 0) point-delta)) + (goto-char beg) + ;; make sure point is at the beginning of a xact + (ledger-navigate-next-xact) + (unless (looking-at ledger-payee-any-status-regex) + (ledger-navigate-next-xact)) + (setq new-beg (point)) + (goto-char end) + (ledger-navigate-next-xact) + ;; make sure end of region is at the beginning of next record + ;; after the region + (setq new-end (point)) + (narrow-to-region new-beg new-end) + (goto-char new-beg) + + (let ((inhibit-field-text-motion t)) + (sort-subr + nil + 'ledger-navigate-next-xact + 'ledger-navigate-end-of-xact + 'ledger-sort-startkey)))) + + (goto-char (point-min)) + (re-search-forward (regexp-quote target-xact)) + (goto-char (+ (match-beginning 0) point-delta)) (setq inhibit-modification-hooks nil))) (defun ledger-sort-buffer () "Sort the entire buffer." (interactive) (let (sort-start - sort-end) - (save-excursion - (goto-char (point-min)) - (setq sort-start (ledger-sort-find-start) - sort-end (ledger-sort-find-end))) + sort-end) + (save-excursion + (goto-char (point-min)) + (setq sort-start (ledger-sort-find-start) + sort-end (ledger-sort-find-end))) (ledger-sort-region (if sort-start - sort-start - (point-min)) - (if sort-end - sort-end - (point-max))))) + sort-start + (point-min)) + (if sort-end + sort-end + (point-max))))) (provide 'ledger-sort) diff --git a/lisp/ledger-state.el b/lisp/ledger-state.el index 121e97ca..47805f15 100644 --- a/lisp/ledger-state.el +++ b/lisp/ledger-state.el @@ -1,6 +1,6 @@ ;;; ledger-state.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. ;;; Commentary: @@ -54,16 +54,26 @@ "Return the char representation of STATE." (if state (if (eq state 'pending) - "!" - "*") - "")) + "!" + "*") + "")) (defun ledger-state-from-char (state-char) "Get state from STATE-CHAR." (cond ((eql state-char ?\!) 'pending) - ((eql state-char ?\*) 'cleared) - ((eql state-char ?\;) 'comment) - (t nil))) + ((eql state-char ?\*) 'cleared) + ((eql state-char ?\;) 'comment) + (t nil))) + + +(defun ledger-state-from-string (state-string) + "Get state from STATE-CHAR." + (when state-string + (cond + ((string-match "\\!" state-string) 'pending) + ((string-match "\\*" state-string) 'cleared) + ((string-match ";" state-string) 'comment) + (t nil)))) (defun ledger-toggle-current-posting (&optional style) "Toggle the cleared status of the transaction under point. @@ -77,16 +87,17 @@ achieved more certainly by passing the xact to ledger for formatting, but doing so causes inline math expressions to be dropped." (interactive) - (let ((bounds (ledger-find-xact-extents (point))) + (let ((bounds (ledger-navigate-find-xact-extents (point))) new-status cur-status) ;; Uncompact the xact, to make it easier to toggle the ;; transaction (save-excursion ;; this excursion checks state of entire - ;; transaction and unclears if marked + ;; transaction and unclears if marked (goto-char (car bounds)) ;; beginning of xact - (skip-chars-forward "0-9./=\\- \t") ;; skip the date + (skip-chars-forward "0-9./=\\-") ;; skip the date + (skip-chars-forward " \t") ;; skip the white space after the date (setq cur-status (and (member (char-after) '(?\* ?\!)) - (ledger-state-from-char (char-after)))) + (ledger-state-from-char (char-after)))) ;;if cur-status if !, or * then delete the marker (when cur-status (let ((here (point))) @@ -97,15 +108,16 @@ dropped." (if (search-forward " " (line-end-position) t) (insert (make-string width ? )))))) (forward-line) - ;; Shift the cleared/pending status to the postings + ;; Shift the cleared/pending status to the postings (while (looking-at "[ \t]") (skip-chars-forward " \t") - (when (not (eq (ledger-state-from-char (char-after)) 'comment)) - (insert (ledger-char-from-state cur-status) " ") - (if (search-forward " " (line-end-position) t) - (delete-char 2))) - (forward-line)) - (setq new-status nil))) + (when (not (eq (ledger-state-from-char (char-after)) 'comment)) + (insert (ledger-char-from-state cur-status) " ") + (if (and (search-forward " " (line-end-position) t) + (looking-at " ")) + (delete-char 2))) + (forward-line)) + (setq new-status nil))) ;;this excursion toggles the posting status (save-excursion @@ -113,40 +125,40 @@ dropped." (goto-char (line-beginning-position)) (when (looking-at "[ \t]") - (skip-chars-forward " \t") - (let ((here (point)) - (cur-status (ledger-state-from-char (char-after)))) - (skip-chars-forward "*! ") - (let ((width (- (point) here))) - (when (> width 0) - (delete-region here (point)) - (save-excursion - (if (search-forward " " (line-end-position) t) - (insert (make-string width ? )))))) - (let (inserted) - (if cur-status - (if (and style (eq style 'cleared)) - (progn - (insert "* ") - (setq inserted 'cleared))) - (if (and style (eq style 'pending)) - (progn - (insert "! ") - (setq inserted 'pending)) - (progn - (insert "* ") - (setq inserted 'cleared)))) - (if (and inserted - (re-search-forward "\\(\t\\| [ \t]\\)" - (line-end-position) t)) - (cond - ((looking-at "\t") - (delete-char 1)) - ((looking-at " [ \t]") - (delete-char 2)) - ((looking-at " ") - (delete-char 1)))) - (setq new-status inserted)))) + (skip-chars-forward " \t") + (let ((here (point)) + (cur-status (ledger-state-from-char (char-after)))) + (skip-chars-forward "*! ") + (let ((width (- (point) here))) + (when (> width 0) + (delete-region here (point)) + (save-excursion + (if (search-forward " " (line-end-position) t) + (insert (make-string width ? )))))) + (let (inserted) + (if cur-status + (if (and style (eq style 'cleared)) + (progn + (insert "* ") + (setq inserted 'cleared))) + (if (and style (eq style 'pending)) + (progn + (insert "! ") + (setq inserted 'pending)) + (progn + (insert "* ") + (setq inserted 'cleared)))) + (if (and inserted + (re-search-forward "\\(\t\\| [ \t]\\)" + (line-end-position) t)) + (cond + ((looking-at "\t") + (delete-char 1)) + ((looking-at " [ \t]") + (delete-char 2)) + ((looking-at " ") + (delete-char 1)))) + (setq new-status inserted)))) (setq inhibit-modification-hooks nil)) ;; This excursion cleans up the xact so that it displays @@ -161,12 +173,12 @@ dropped." (while (and (not hetero) (looking-at "[ \t]")) (skip-chars-forward " \t") (let ((cur-status (ledger-state-from-char (char-after)))) - (if (not (eq cur-status 'comment)) - (if first - (setq state cur-status - first nil) - (if (not (eq state cur-status)) - (setq hetero t))))) + (if (not (eq cur-status 'comment)) + (if first + (setq state cur-status + first nil) + (if (not (eq state cur-status)) + (setq hetero t))))) (forward-line)) (when (and (not hetero) (not (eq state nil))) (goto-char (car bounds)) @@ -183,18 +195,19 @@ dropped." (insert (make-string width ? )))))) (forward-line)) (goto-char (car bounds)) - (skip-chars-forward "0-9./=\\- \t") + (skip-chars-forward "0-9./=\\-") ;; Skip the date + (skip-chars-forward " \t") ;; Skip the white space (insert (ledger-char-from-state state) " ") - (setq new-status state) + (setq new-status state) (if (re-search-forward "\\(\t\\| [ \t]\\)" (line-end-position) t) (cond - ((looking-at "\t") - (delete-char 1)) - ((looking-at " [ \t]") - (delete-char 2)) - ((looking-at " ") - (delete-char 1))))))) + ((looking-at "\t") + (delete-char 1)) + ((looking-at " [ \t]") + (delete-char 2)) + ((looking-at " ") + (delete-char 1))))))) new-status)) (defun ledger-toggle-current (&optional style) @@ -214,30 +227,30 @@ dropped." (forward-line) (goto-char (line-beginning-position)))) (ledger-toggle-current-transaction style)) - (ledger-toggle-current-posting style))) + (ledger-toggle-current-posting style))) (defun ledger-toggle-current-transaction (&optional style) "Toggle the transaction at point using optional STYLE." (interactive) (save-excursion (when (or (looking-at "^[0-9]") - (re-search-backward "^[0-9]" nil t)) + (re-search-backward "^[0-9]" nil t)) (skip-chars-forward "0-9./=\\-") (delete-horizontal-space) (if (or (eq (ledger-state-from-char (char-after)) 'pending) - (eq (ledger-state-from-char (char-after)) 'cleared)) - (progn - (delete-char 1) - (when (and style (eq style 'cleared)) - (insert " *") - 'cleared)) - (if (and style (eq style 'pending)) - (progn - (insert " ! ") - 'pending) - (progn - (insert " * ") - 'cleared)))))) + (eq (ledger-state-from-char (char-after)) 'cleared)) + (progn + (delete-char 1) + (when (and style (eq style 'cleared)) + (insert " *") + 'cleared)) + (if (and style (eq style 'pending)) + (progn + (insert " ! ") + 'pending) + (progn + (insert " * ") + 'cleared)))))) (provide 'ledger-state) diff --git a/lisp/ledger-test.el b/lisp/ledger-test.el index a275ae7f..da120f63 100644 --- a/lisp/ledger-test.el +++ b/lisp/ledger-test.el @@ -1,6 +1,6 @@ ;;; ledger-test.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,18 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. + +;;; Commentary: + +;;; Code: + +(declare-function ledger-mode "ledger-mode") ; TODO: fix this cyclic dependency +(declare-function org-narrow-to-subtree "org") +(declare-function org-entry-get "org") +(declare-function outline-back-to-heading "outline") +(declare-function outline-next-heading "outline") (defgroup ledger-test nil "Definitions for the Ledger testing framework" @@ -98,9 +108,9 @@ (ledger-mode) (if input (insert input) - (insert "2012-03-17 Payee\n") - (insert " Expenses:Food $20\n") - (insert " Assets:Cash\n")) + (insert "2012-03-17 Payee\n") + (insert " Expenses:Food $20\n") + (insert " Assets:Cash\n")) (insert "\ntest reg\n") (if output (insert output)) @@ -121,7 +131,9 @@ (let ((prev-directory default-directory)) (cd ledger-source-directory) (unwind-protect - (async-shell-command (format "\"%s\" %s" command args)) + (async-shell-command (format "\"%s\" %s" command args)) (cd prev-directory))))))) (provide 'ledger-test) + +;;; ledger-test.el ends here diff --git a/lisp/ledger-texi.el b/lisp/ledger-texi.el index 68880550..afaf0df7 100644 --- a/lisp/ledger-texi.el +++ b/lisp/ledger-texi.el @@ -1,6 +1,6 @@ ;;; ledger-texi.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,22 +16,22 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. (defgroup ledger-texi nil -"Options for working on Ledger texi documentation" -:group 'ledger) + "Options for working on Ledger texi documentation" + :group 'ledger) (defcustom ledger-texi-sample-doc-path "~/ledger/doc/sample.dat" -"Location for sample data to be used in texi tests" -:type 'file -:group 'ledger-texi) + "Location for sample data to be used in texi tests" + :type 'file + :group 'ledger-texi) (defcustom ledger-texi-normalization-args "--args-only --columns 80" -"texi normalization for producing ledger output" -:type 'string -:group 'ledger-texi) + "texi normalization for producing ledger output" + :type 'string + :group 'ledger-texi) (defun ledger-update-test () (interactive) @@ -104,17 +104,17 @@ (if (string-match "\\$LEDGER" command) (replace-match (format "%s -f \"%s\" %s" ledger-binary-path data-file ledger-texi-normalization-args) t t command) - (concat (format "%s -f \"%s\" %s " ledger-binary-path - data-file ledger-texi-normalization-args) command))) + (concat (format "%s -f \"%s\" %s " ledger-binary-path + data-file ledger-texi-normalization-args) command))) (defun ledger-texi-invoke-command (command) (with-temp-buffer (shell-command command t (current-buffer)) - (if (= (point-min) (point-max)) - (progn - (push-mark nil t) - (message "Command '%s' yielded no result at %d" command (point)) - (ding)) - (buffer-string)))) + (if (= (point-min) (point-max)) + (progn + (push-mark nil t) + (message "Command '%s' yielded no result at %d" command (point)) + (ding)) + (buffer-string)))) (defun ledger-texi-write-test-data (name input) (let ((path (expand-file-name name temporary-file-directory))) @@ -159,7 +159,7 @@ (let ((section-name (if (string= section "smex") "smallexample" - "example")) + "example")) (output (ledger-texi-invoke-command (ledger-texi-expand-command command data-file)))) (insert "@" section-name ?\n output diff --git a/lisp/ledger-xact.el b/lisp/ledger-xact.el index e6269580..0eb9386a 100644 --- a/lisp/ledger-xact.el +++ b/lisp/ledger-xact.el @@ -1,6 +1,6 @@ ;;; ledger-xact.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2013 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -16,8 +16,8 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -;; MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. ;;; Commentary: @@ -25,6 +25,11 @@ ;;; Code: +(require 'eshell) +(require 'ledger-regex) +(require 'ledger-navigate) +;; TODO: This file depends on code in ledger-mode.el, which depends on this. + (defcustom ledger-highlight-xact-under-point t "If t highlight xact under point." :type 'boolean @@ -36,38 +41,23 @@ :group 'ledger :safe t) -(defvar highlight-overlay (list)) - -(defun ledger-find-xact-extents (pos) - "Return point for beginning of xact and and of xact containing position. -Requires empty line separating xacts. Argument POS is a location -within the transaction." - (interactive "d") - (save-excursion - (goto-char pos) - (list (progn - (backward-paragraph) - (if (/= (point) (point-min)) - (forward-line)) - (line-beginning-position)) - (progn - (forward-paragraph) - (line-beginning-position))))) +(defvar ledger-xact-highlight-overlay (list)) +(make-variable-buffer-local 'ledger-xact-highlight-overlay) (defun ledger-highlight-xact-under-point () "Move the highlight overlay to the current transaction." (if ledger-highlight-xact-under-point - (let ((exts (ledger-find-xact-extents (point))) - (ovl highlight-overlay)) - (if (not highlight-overlay) - (setq ovl - (setq highlight-overlay - (make-overlay (car exts) - (cadr exts) - (current-buffer) t nil))) - (move-overlay ovl (car exts) (cadr exts))) - (overlay-put ovl 'face 'ledger-font-xact-highlight-face) - (overlay-put ovl 'priority 100)))) + (let ((exts (ledger-navigate-find-element-extents (point))) + (ovl ledger-xact-highlight-overlay)) + (if (not ledger-xact-highlight-overlay) + (setq ovl + (setq ledger-xact-highlight-overlay + (make-overlay (car exts) + (cadr exts) + (current-buffer) t nil))) + (move-overlay ovl (car exts) (cadr exts))) + (overlay-put ovl 'face 'ledger-font-xact-highlight-face) + (overlay-put ovl 'priority '(nil . 99))))) (defun ledger-xact-payee () "Return the payee of the transaction containing point or nil." @@ -77,7 +67,7 @@ within the transaction." (let ((context-info (ledger-context-other-line i))) (if (eq (ledger-context-line-type context-info) 'xact) (ledger-context-field-value context-info 'payee) - nil)))) + nil)))) (defun ledger-time-less-p (t1 t2) "Say whether time value T1 is less than time value T2." @@ -88,12 +78,20 @@ within the transaction." (defun ledger-xact-find-slot (moment) "Find the right place in the buffer for a transaction at MOMENT. MOMENT is an encoded date" - (catch 'found - (ledger-xact-iterate-transactions - (function - (lambda (start date mark desc) - (if (ledger-time-less-p moment date) - (throw 'found t))))))) + (let (last-xact-start) + (catch 'found + (ledger-xact-iterate-transactions + (function + (lambda (start date mark desc) + (setq last-xact-start start) + (if (ledger-time-less-p moment date) + (throw 'found t)))))) + (when (and (eobp) last-xact-start) + (let ((end (cadr (ledger-navigate-find-xact-extents last-xact-start)))) + (goto-char end) + (if (eobp) + (insert "\n") + (forward-line)))))) (defun ledger-xact-iterate-transactions (callback) "Iterate through each transaction call CALLBACK for each." @@ -105,49 +103,43 @@ MOMENT is an encoded date" (let ((found-y-p (match-string 2))) (if found-y-p (setq current-year (string-to-number found-y-p)) ;; a Y directive was found - (let ((start (match-beginning 0)) - (year (match-string 4)) - (month (string-to-number (match-string 5))) - (day (string-to-number (match-string 6))) - (mark (match-string 7)) - (code (match-string 8)) - (desc (match-string 9))) - (if (and year (> (length year) 0)) - (setq year (string-to-number year))) - (funcall callback start - (encode-time 0 0 0 day month - (or year current-year)) - mark desc))))) + (let ((start (match-beginning 0)) + (year (match-string 4)) + (month (string-to-number (match-string 5))) + (day (string-to-number (match-string 6))) + (mark (match-string 7)) + (code (match-string 8)) + (desc (match-string 9))) + (if (and year (> (length year) 0)) + (setq year (string-to-number year))) + (funcall callback start + (encode-time 0 0 0 day month + (or year current-year)) + mark desc))))) (forward-line)))) -(defsubst ledger-goto-line (line-number) - "Rapidly move point to line LINE-NUMBER." - (goto-char (point-min)) - (forward-line (1- line-number))) - (defun ledger-year-and-month () (let ((sep (if ledger-use-iso-dates "-" "/"))) - (concat ledger-year sep ledger-month sep))) + (concat ledger-year sep ledger-month sep))) (defun ledger-copy-transaction-at-point (date) "Ask for a new DATE and copy the transaction under point to that date. Leave point on the first amount." (interactive (list - (read-string "Copy to date: " (ledger-year-and-month) - 'ledger-minibuffer-history))) + (ledger-read-date "Copy to date: "))) (let* ((here (point)) - (extents (ledger-find-xact-extents (point))) - (transaction (buffer-substring-no-properties (car extents) (cadr extents))) - encoded-date) + (extents (ledger-navigate-find-xact-extents (point))) + (transaction (buffer-substring-no-properties (car extents) (cadr extents))) + encoded-date) (if (string-match ledger-iso-date-regexp date) - (setq encoded-date - (encode-time 0 0 0 (string-to-number (match-string 4 date)) - (string-to-number (match-string 3 date)) - (string-to-number (match-string 2 date))))) + (setq encoded-date + (encode-time 0 0 0 (string-to-number (match-string 4 date)) + (string-to-number (match-string 3 date)) + (string-to-number (match-string 2 date))))) (ledger-xact-find-slot encoded-date) (insert transaction "\n") - (backward-paragraph 2) + (ledger-navigate-beginning-of-xact) (re-search-forward ledger-iso-date-regexp) (replace-match date) (ledger-next-amount) @@ -155,18 +147,20 @@ MOMENT is an encoded date" (goto-char (match-beginning 0))))) (defun ledger-delete-current-transaction (pos) - "Delete the transaction surrounging point." + "Delete the transaction surrounging POS." (interactive "d") - (let ((bounds (ledger-find-xact-extents pos))) + (let ((bounds (ledger-navigate-find-xact-extents pos))) (delete-region (car bounds) (cadr bounds)))) (defun ledger-add-transaction (transaction-text &optional insert-at-point) "Use ledger xact TRANSACTION-TEXT to add a transaction to the buffer. -If INSERT-AT-POINT is non-nil insert the transaction -there, otherwise call `ledger-xact-find-slot' to insert it at the +If INSERT-AT-POINT is non-nil insert the transaction there, +otherwise call `ledger-xact-find-slot' to insert it at the correct chronological place in the buffer." (interactive (list - (read-string "Transaction: " (ledger-year-and-month)))) + ;; Note: This isn't "just" the date - it can contain + ;; other text too + (ledger-read-date "Transaction: "))) (let* ((args (with-temp-buffer (insert transaction-text) (eshell-parse-arguments (point-min) (point-max)))) @@ -181,21 +175,21 @@ correct chronological place in the buffer." (string-to-number (match-string 2 date))))) (ledger-xact-find-slot date))) (if (> (length args) 1) - (save-excursion - (insert - (with-temp-buffer - (setq exit-code - (apply #'ledger-exec-ledger ledger-buf (current-buffer) "xact" - (mapcar 'eval args))) - (goto-char (point-min)) - (if (looking-at "Error: ") - (error (concat "Error in ledger-add-transaction: " (buffer-string))) - (buffer-string))) - "\n")) - (progn - (insert (car args) " \n\n") - (end-of-line -1))))) - + (save-excursion + (insert + (with-temp-buffer + (setq exit-code + (apply #'ledger-exec-ledger ledger-buf (current-buffer) "xact" + (mapcar 'eval args))) + (goto-char (point-min)) + (if (looking-at "Error: ") + (error (concat "Error in ledger-add-transaction: " (buffer-string))) + (ledger-post-align-postings (point-min) (point-max)) + (buffer-string))) + "\n")) + (progn + (insert (car args) " \n\n") + (end-of-line -1))))) (provide 'ledger-xact) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9fd7d295..7b10061f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -49,9 +49,10 @@ set(LEDGER_SOURCES times.cc error.cc utils.cc - strptime.cc) + strptime.cc + wcwidth.cc) -if(HAVE_BOOST_PYTHON) +if (HAVE_BOOST_PYTHON) list(APPEND LEDGER_SOURCES py_account.cc py_amount.cc @@ -134,8 +135,8 @@ set(LEDGER_INCLUDES strptime.h ${PROJECT_BINARY_DIR}/system.hh) -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - if((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER MATCHES "cxx")) +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + if ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER MATCHES "cxx")) add_definitions( -Weverything -Wno-disabled-macro-expansion @@ -155,7 +156,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") set_source_files_properties( ${${_src_list}} PROPERTIES COMPILE_FLAGS "-include ${_header_filename}") - if(_other_srcs) + if (_other_srcs) set_source_files_properties( ${_other_srcs} PROPERTIES COMPILE_FLAGS "-include ${_header_filename}") endif() @@ -163,6 +164,13 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(_args ${CMAKE_CXX_FLAGS}) list(APPEND _args ${CMAKE_CXX_FLAGS_DEBUG}) + if (BUILD_LIBRARY) + list(APPEND _args ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + endif() + list(APPEND _args "-std=c++11 ") + if (CYGWIN) + list(APPEND _args "-U__STRICT_ANSI__") + endif() list(APPEND _args "-x c++-header " ${_inc}) list(APPEND _args -c ${_header_filename} -o ${_pch_filename}) @@ -181,7 +189,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_CXX_COMPILER MATCHES "g\\+\\+") set(GXX_WARNING_FLAGS - -ansi -pedantic -Wall -Winvalid-pch @@ -207,7 +214,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") set_source_files_properties( ${${_src_list}} PROPERTIES COMPILE_FLAGS "-Winvalid-pch") - if(_other_srcs) + if (_other_srcs) set_source_files_properties( ${_other_srcs} PROPERTIES COMPILE_FLAGS "-Winvalid-pch") endif() @@ -215,7 +222,14 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(_args ${CMAKE_CXX_FLAGS}) list(APPEND _args ${CMAKE_CXX_FLAGS_DEBUG}) + if (BUILD_LIBRARY) + list(APPEND _args ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + endif() list(APPEND _args ${GXX_WARNING_FLAGS}) + list(APPEND _args "-std=c++11 ") + if (CYGWIN) + list(APPEND _args "-U__STRICT_ANSI__") + endif() list(APPEND _args "-x c++-header " ${_inc}) list(APPEND _args -c ${_header_filename} -o ${_gch_filename}) @@ -243,21 +257,63 @@ endif() add_pch_rule(${PROJECT_BINARY_DIR}/system.hh LEDGER_SOURCES main.cc global.cc) -if(BUILD_LIBRARY) - add_library(libledger ${LEDGER_SOURCES} ${PROJECT_SOURCE_DIR}/lib/sha1.cpp) - set_target_properties(libledger PROPERTIES OUTPUT_NAME ledger) +include(GNUInstallDirs) + +if (BUILD_LIBRARY) + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + add_library(libledger SHARED ${LEDGER_SOURCES}) + add_ledger_library_dependencies(libledger) + set_target_properties(libledger PROPERTIES + PREFIX "" + INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" + VERSION ${Ledger_VERSION_MAJOR} + SOVERSION ${Ledger_VERSION_MAJOR}) add_executable(ledger main.cc global.cc) + target_link_libraries(ledger libledger) - install(TARGETS libledger DESTINATION lib) - install(FILES ${LEDGER_INCLUDES} DESTINATION include/ledger) + install(TARGETS libledger DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(FILES ${LEDGER_INCLUDES} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ledger) else() - add_executable(ledger - ${LEDGER_SOURCES} ${PROJECT_SOURCE_DIR}/lib/sha1.cpp main.cc global.cc) + add_executable(ledger ${LEDGER_SOURCES} main.cc global.cc) + add_ledger_library_dependencies(ledger) endif() -add_ledger_library_dependencies(ledger) +if (USE_PYTHON) + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c + "from __future__ import print_function +import distutils.sysconfig as s +print(s.get_python_lib(True, prefix=''))" + OUTPUT_VARIABLE _TMP_PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE) + set(PYTHON_SITE_PACKAGES ${_TMP_PYTHON_SITE_PACKAGES} + CACHE PATH "python module directory (${_TMP_PYTHON_SITE_PACKAGES})") + + if (PYTHON_SITE_PACKAGES) + if (WIN32 AND NOT CYGWIN) + set(_ledger_python_module_name "ledger.pyd") + elseif(CMAKE_HOST_APPLE) + set(_ledger_python_module_name "ledger.so") + else() + set(_ledger_python_module_name "ledger${CMAKE_SHARED_LIBRARY_SUFFIX}") + endif() + + # FIXME: symlink would be sufficient: + # maybe using install(CODE "...") and + # execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink ...). + # Windows will need a special case due to not supporting symlinks. + add_custom_command( + TARGET libledger POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $<TARGET_FILE:libledger> "${CMAKE_BINARY_DIR}/${_ledger_python_module_name}") + install( + FILES "${CMAKE_BINARY_DIR}/${_ledger_python_module_name}" + DESTINATION ${PYTHON_SITE_PACKAGES}) + else() + message(WARNING "PYTHON_SITE_PACKAGES not set. Will not install python module.") + endif() +endif() -install(TARGETS ledger DESTINATION bin) +install(TARGETS ledger DESTINATION ${CMAKE_INSTALL_BINDIR}) ### CMakeLists.txt ends here diff --git a/src/account.cc b/src/account.cc index 58812db9..358aa09a 100644 --- a/src/account.cc +++ b/src/account.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -139,6 +139,36 @@ void account_t::add_post(post_t * post) } } +void account_t::add_deferred_post(const string& uuid, post_t * post) +{ + if (! deferred_posts) + deferred_posts = deferred_posts_map_t(); + + deferred_posts_map_t::iterator i = deferred_posts->find(uuid); + if (i == deferred_posts->end()) { + posts_list lst; + lst.push_back(post); + deferred_posts->insert(deferred_posts_map_t::value_type(uuid, lst)); + } else { + (*i).second.push_back(post); + } +} + +void account_t::apply_deferred_posts() +{ + if (deferred_posts) { + foreach (deferred_posts_map_t::value_type& pair, *deferred_posts) { + foreach (post_t * post, pair.second) + post->account->add_post(post); + } + deferred_posts = none; + } + + // Also apply in child accounts + foreach (const accounts_map::value_type& pair, accounts) + pair.second->apply_deferred_posts(); +} + bool account_t::remove_post(post_t * post) { // It's possible that 'post' wasn't yet in this account, but try to diff --git a/src/account.h b/src/account.h index b726facf..76e839eb 100644 --- a/src/account.h +++ b/src/account.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -52,6 +52,7 @@ class post_t; typedef std::list<post_t *> posts_list; typedef std::map<string, account_t *> accounts_map; +typedef std::map<string, posts_list> deferred_posts_map_t; class account_t : public supports_flags<>, public scope_t { @@ -61,13 +62,14 @@ class account_t : public supports_flags<>, public scope_t #define ACCOUNT_GENERATED 0x04 // account never actually existed public: - account_t * parent; - string name; - optional<string> note; - unsigned short depth; - accounts_map accounts; - posts_list posts; - optional<expr_t> value_expr; + account_t * parent; + string name; + optional<string> note; + unsigned short depth; + accounts_map accounts; + posts_list posts; + optional<deferred_posts_map_t> deferred_posts; + optional<expr_t> value_expr; mutable string _fullname; #if DOCUMENT_MODEL @@ -136,6 +138,8 @@ public: } void add_post(post_t * post); + void add_deferred_post(const string& uuid, post_t * post); + void apply_deferred_posts(); bool remove_post(post_t * post); posts_list::iterator posts_begin() { @@ -257,7 +261,11 @@ public: mutable optional<xdata_t> xdata_; bool has_xdata() const { +#if BOOST_VERSION >= 105600 + return xdata_ != NULL; +#else return xdata_; +#endif } void clear_xdata(); xdata_t& xdata() { diff --git a/src/amount.cc b/src/amount.cc index 6ff2f4dd..6ddcdb4f 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -301,7 +301,7 @@ void amount_t::_copy(const amount_t& amt) quantity = new bigint_t(*amt.quantity); } else { quantity = amt.quantity; - DEBUG("amounts.refs", + DEBUG("amount.refs", quantity << " refc++, now " << (quantity->refc + 1)); quantity->refc++; } @@ -339,7 +339,7 @@ void amount_t::_release() { VERIFY(valid()); - DEBUG("amounts.refs", quantity << " refc--, now " << (quantity->refc - 1)); + DEBUG("amount.refs", quantity << " refc--, now " << (quantity->refc - 1)); if (--quantity->refc == 0) { if (quantity->has_flags(BIGINT_BULK_ALLOC)) @@ -928,7 +928,7 @@ void amount_t::annotate(const annotation_t& details) } assert(this_base); - DEBUG("amounts.commodities", "Annotating commodity for amount " + DEBUG("amount.commodities", "Annotating commodity for amount " << *this << std::endl << details); if (commodity_t * ann_comm = @@ -939,7 +939,7 @@ void amount_t::annotate(const annotation_t& details) assert(false); #endif - DEBUG("amounts.commodities", "Annotated amount is " << *this); + DEBUG("amount.commodities", "Annotated amount is " << *this); } bool amount_t::has_annotation() const diff --git a/src/amount.h b/src/amount.h index 938d4b7b..ea5cadd6 100644 --- a/src/amount.h +++ b/src/amount.h @@ -1,9 +1,9 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * modification, are permitted provided that the following conditions are + * met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. diff --git a/src/annotate.cc b/src/annotate.cc index 8816a89c..7c54edef 100644 --- a/src/annotate.cc +++ b/src/annotate.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -187,8 +187,8 @@ void annotation_t::parse(std::istream& in) } while (true); #if DEBUG_ON - if (SHOW_DEBUG("amounts.commodities") && *this) { - DEBUG("amounts.commodities", + if (SHOW_DEBUG("amount.commodities") && *this) { + DEBUG("amount.commodities", "Parsed commodity annotations: " << std::endl << *this); } #endif @@ -206,7 +206,7 @@ void annotation_t::print(std::ostream& out, bool keep_base, if (date && (! no_computed_annotations || ! has_flags(ANNOTATION_DATE_CALCULATED))) - out << " [" << format_date(*date, FMT_WRITTEN) << ']'; + out << " [" << format_date(*date, FMT_PRINTED) << ']'; if (tag && (! no_computed_annotations || ! has_flags(ANNOTATION_TAG_CALCULATED))) diff --git a/src/annotate.h b/src/annotate.h index 998f7c83..c0fbcd3d 100644 --- a/src/annotate.h +++ b/src/annotate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/archive.cc b/src/archive.cc index 6ac1c580..9ae04e85 100644 --- a/src/archive.cc +++ b/src/archive.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/archive.h b/src/archive.h index 5c15a9fb..485f9606 100644 --- a/src/archive.h +++ b/src/archive.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/balance.cc b/src/balance.cc index b702cb7b..36eab7d4 100644 --- a/src/balance.cc +++ b/src/balance.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/balance.h b/src/balance.h index a1ae51ef..752bb4d6 100644 --- a/src/balance.h +++ b/src/balance.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/chain.cc b/src/chain.cc index b2f6f203..42f474c4 100644 --- a/src/chain.cc +++ b/src/chain.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/chain.h b/src/chain.h index de7f68c7..224bed21 100644 --- a/src/chain.h +++ b/src/chain.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/commodity.cc b/src/commodity.cc index 535b31c9..398245fb 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/commodity.h b/src/commodity.h index d521d80e..3d1ddf04 100644 --- a/src/commodity.h +++ b/src/commodity.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/compare.cc b/src/compare.cc index 946cd835..db169cfc 100644 --- a/src/compare.cc +++ b/src/compare.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/compare.h b/src/compare.h index 4a91f49f..554e84aa 100644 --- a/src/compare.h +++ b/src/compare.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/context.h b/src/context.h index e5457641..e787f335 100644 --- a/src/context.h +++ b/src/context.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -101,10 +101,10 @@ public: } void warning(const string& what) const { - warning_func(location() + what); + warning_func(location() + " " + what); } void warning(const boost::format& what) const { - warning_func(location() + string(what.str())); + warning_func(location() + " " + string(what.str())); } }; diff --git a/src/convert.cc b/src/convert.cc index 38ef2c22..a4454c14 100644 --- a/src/convert.cc +++ b/src/convert.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -86,7 +86,7 @@ value_t convert_command(call_scope_t& args) if (entry != journal.checksum_map.end()) { INFO(file_context(reader.get_pathname(), reader.get_linenum()) - << "Ignoring known UUID " << ref); + << " " << "Ignoring known UUID " << ref); checked_delete(xact); // ignore it continue; } diff --git a/src/convert.h b/src/convert.h index 17fb4505..020dfea2 100644 --- a/src/convert.h +++ b/src/convert.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -186,7 +186,7 @@ xact_t * csv_reader::read_xact(bool rich_data) case FIELD_PAYEE: { bool found = false; - foreach (payee_mapping_t& value, context.journal->payee_mappings) { + foreach (payee_alias_mapping_t& value, context.journal->payee_alias_mappings) { DEBUG("csv.mappings", "Looking for payee mapping: " << value.first); if (value.first.match(field)) { xact->payee = value.second; @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/draft.cc b/src/draft.cc index 6aef2f12..78e53ccd 100644 --- a/src/draft.cc +++ b/src/draft.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/draft.h b/src/draft.h index 1cc362ba..7ba40640 100644 --- a/src/draft.h +++ b/src/draft.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/emacs.cc b/src/emacs.cc index 9bfd1e4b..dc16c002 100644 --- a/src/emacs.cc +++ b/src/emacs.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -30,7 +30,7 @@ */ #include <system.hh> - +#include <boost/algorithm/string.hpp> #include "emacs.h" #include "xact.h" #include "post.h" @@ -38,78 +38,84 @@ namespace ledger { -void format_emacs_posts::write_xact(xact_t& xact) -{ - if (xact.pos) - out << "\"" << xact.pos->pathname.string() << "\" " - << xact.pos->beg_line << " "; - else - out << "\"\" " << -1 << " "; - - tm when = gregorian::to_tm(xact.date()); - std::time_t date = std::mktime(&when); - - out << "(" << (date / 65536) << " " << (date % 65536) << " 0) "; - - if (xact.code) - out << "\"" << *xact.code << "\" "; - else - out << "nil "; - - if (xact.payee.empty()) - out << "nil"; - else - out << "\"" << xact.payee << "\""; - - out << "\n"; -} - -void format_emacs_posts::operator()(post_t& post) -{ - if (! post.has_xdata() || - ! post.xdata().has_flags(POST_EXT_DISPLAYED)) { - if (! last_xact) { - out << "(("; - write_xact(*post.xact); - } - else if (post.xact != last_xact) { - out << ")\n ("; - write_xact(*post.xact); - } - else { - out << "\n"; - } - - if (post.pos) - out << " (" << post.pos->beg_line << " "; - else - out << " (" << -1 << " "; - - out << "\"" << post.reported_account()->fullname() << "\" \"" - << post.amount << "\""; - - switch (post.state()) { - case item_t::UNCLEARED: - out << " nil"; - break; - case item_t::CLEARED: - out << " t"; - break; - case item_t::PENDING: - out << " pending"; - break; - } - - if (post.cost) - out << " \"" << *post.cost << "\""; - if (post.note) - out << " \"" << *post.note << "\""; - out << ")"; - - last_xact = post.xact; - - post.xdata().add_flags(POST_EXT_DISPLAYED); - } -} + void format_emacs_posts::write_xact(xact_t& xact) + { + if (xact.pos) + out << "\"" << xact.pos->pathname.string() << "\" " + << xact.pos->beg_line << " "; + else + out << "\"\" " << -1 << " "; + + tm when = gregorian::to_tm(xact.date()); + std::time_t date = std::mktime(&when); + + out << "(" << (date / 65536) << " " << (date % 65536) << " 0) "; + + if (xact.code) + out << "\"" << *xact.code << "\" "; + else + out << "nil "; + + if (xact.payee.empty()) + out << "nil"; + else + out << "\"" << xact.payee << "\""; + + out << "\n"; + } + + void format_emacs_posts::operator()(post_t& post) + { + if (! post.has_xdata() || + ! post.xdata().has_flags(POST_EXT_DISPLAYED)) { + if (! last_xact) { + out << "(("; + write_xact(*post.xact); + } + else if (post.xact != last_xact) { + out << ")\n ("; + write_xact(*post.xact); + } + else { + out << "\n"; + } + + if (post.pos) + out << " (" << post.pos->beg_line << " "; + else + out << " (" << -1 << " "; + + out << "\"" << post.reported_account()->fullname() << "\" \"" + << post.amount << "\""; + + switch (post.state()) { + case item_t::UNCLEARED: + out << " nil"; + break; + case item_t::CLEARED: + out << " t"; + break; + case item_t::PENDING: + out << " pending"; + break; + } + + if (post.cost) + out << " \"" << *post.cost << "\""; + if (post.note) + out << " \"" << escape_string(*post.note) << "\""; + out << ")"; + + last_xact = post.xact; + + post.xdata().add_flags(POST_EXT_DISPLAYED); + } + } + + string format_emacs_posts::escape_string(string raw){ + replace_all(raw, "\\", "\\\\"); + replace_all(raw, "\"", "\\\""); + return raw; + } } // namespace ledger diff --git a/src/emacs.h b/src/emacs.h index 368c4c4d..fef7a882 100644 --- a/src/emacs.h +++ b/src/emacs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -72,6 +72,7 @@ public: out.flush(); } virtual void operator()(post_t& post); + virtual string escape_string(string raw); }; } // namespace ledger diff --git a/src/error.cc b/src/error.cc index acee85c9..90697c5f 100644 --- a/src/error.cc +++ b/src/error.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -49,7 +49,7 @@ string error_context() string file_context(const path& file, const std::size_t line) { std::ostringstream buf; - buf << '"' << file.string() << "\", line " << line << ": "; + buf << '"' << file.string() << "\", line " << line << ":"; return buf.str(); } diff --git a/src/error.h b/src/error.h index 93d92109..31fa76a3 100644 --- a/src/error.h +++ b/src/error.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/expr.cc b/src/expr.cc index aa1e07d2..e38d794f 100644 --- a/src/expr.cc +++ b/src/expr.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/exprbase.h b/src/exprbase.h index 88d6f118..b88fcd7d 100644 --- a/src/exprbase.h +++ b/src/exprbase.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/filters.cc b/src/filters.cc index 2b4fe1bf..fd30c966 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -237,7 +237,7 @@ void anonymize_posts::render_commodity(amount_t& amt) void anonymize_posts::operator()(post_t& post) { - SHA1 sha; + boost::uuids::detail::sha1 sha; unsigned int message_digest[5]; bool copy_xact_details = false; @@ -256,9 +256,9 @@ void anonymize_posts::operator()(post_t& post) buf << reinterpret_cast<uintmax_t>(post.xact->payee.c_str()) << integer_gen() << post.xact->payee.c_str(); - sha.Reset(); - sha << buf.str().c_str(); - sha.Result(message_digest); + sha.reset(); + sha.process_bytes(buf.str().c_str(), buf.str().length()); + sha.get_digest(message_digest); xact.payee = to_hex(message_digest); xact.note = none; @@ -274,9 +274,9 @@ void anonymize_posts::operator()(post_t& post) std::ostringstream buf; buf << integer_gen() << acct << acct->fullname(); - sha.Reset(); - sha << buf.str().c_str(); - sha.Result(message_digest); + sha.reset(); + sha.process_bytes(buf.str().c_str(), buf.str().length()); + sha.get_digest(message_digest); account_names.push_front(to_hex(message_digest)); } @@ -1002,7 +1002,7 @@ void interval_posts::flush() sort_posts_by_date()); // Determine the beginning interval by using the earliest post - if (all_posts.front() && + if (all_posts.size() > 0 && all_posts.front() && ! interval.find_period(all_posts.front()->date())) throw_(std::logic_error, _("Failed to find period for interval report")); diff --git a/src/filters.h b/src/filters.h index d6e1b6fc..9b745235 100644 --- a/src/filters.h +++ b/src/filters.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/flags.h b/src/flags.h index d584e2d0..f3593517 100644 --- a/src/flags.h +++ b/src/flags.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/format.cc b/src/format.cc index e0f74616..2887a387 100644 --- a/src/format.cc +++ b/src/format.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -74,17 +74,18 @@ namespace { char letter; const char * expr; } single_letter_mappings[] = { - { 'd', "date" }, + { 'd', "aux_date ? format_date(date) + \"=\" + format_date(aux_date) : format_date(date)" }, + { 'D', "date" }, { 'S', "filename" }, { 'B', "beg_pos" }, { 'b', "beg_line" }, { 'E', "end_pos" }, { 'e', "end_line" }, - { 'X', "cleared" }, - { 'Y', "xact.cleared" }, - { 'C', "code" }, + { 'X', "\"* \" if cleared" }, + { 'Y', "\"* \" if xact.cleared" }, + { 'C', "\"(\" + code + \") \" if code" }, { 'P', "payee" }, - { 'a', "account.name" }, + { 'a', "account" }, { 'A', "account" }, { 't', "justify(scrub(display_amount), $min, $max, $left, color)" }, { 'T', "justify(scrub(display_total), $min, $max, $left, color)" }, @@ -206,7 +207,7 @@ format_t::element_t * format_t::parse_elements(const string& fmt, sizeof(format_mapping_t)); i++) { if (*p == single_letter_mappings[i].letter) { std::ostringstream expr; - for (const char * ptr = single_letter_mappings[i].expr; *ptr; ){ + for (const char * ptr = single_letter_mappings[i].expr; *ptr;) { if (*ptr == '$') { const char * beg = ++ptr; while (*ptr && std::isalpha(*ptr)) diff --git a/src/format.h b/src/format.h index 38f567bd..6ac4075e 100644 --- a/src/format.h +++ b/src/format.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/generate.cc b/src/generate.cc index 5bf424bb..6503f414 100644 --- a/src/generate.cc +++ b/src/generate.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/generate.h b/src/generate.h index 697feb64..b17116fa 100644 --- a/src/generate.h +++ b/src/generate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/global.cc b/src/global.cc index 0061ad76..602e216c 100644 --- a/src/global.cc +++ b/src/global.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -142,13 +142,13 @@ void global_scope_t::read_init() throw_(parse_error, _f("Could not find specified init file %1%") % init_file); } } else { - if (const char * home_var = std::getenv("HOME")){ + if (const char * home_var = std::getenv("HOME")) { init_file = (path(home_var) / ".ledgerrc"); } else { init_file = ("./.ledgerrc"); } } - if(exists(init_file)){ + if (exists(init_file)) { parse_init(init_file); } } @@ -388,7 +388,7 @@ void global_scope_t::read_environment_settings(char * envp[]) process_environment(const_cast<const char **>(envp), "LEDGER_", report()); #if 1 - // These are here for backwards compatability, but are deprecated. + // These are here for backwards compatibility, but are deprecated. if (const char * p = std::getenv("LEDGER")) { if (! std::getenv("LEDGER_FILE")) @@ -514,7 +514,7 @@ void handle_debug_options(int argc, char * argv[]) #if TRACING_ON _log_level = LOG_TRACE; try { - _trace_level = boost::lexical_cast<uint8_t>(argv[i + 1]); + _trace_level = boost::lexical_cast<uint16_t>(argv[i + 1]); } catch (const boost::bad_lexical_cast&) { throw std::logic_error(_("Argument to --trace must be an integer")); diff --git a/src/global.h b/src/global.h index 5fa67d2c..f36dbe3d 100644 --- a/src/global.h +++ b/src/global.h @@ -1,9 +1,9 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * modification, are permitted provided that the following conditions are + * met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. @@ -127,7 +127,7 @@ public: out << '-' << Ledger_VERSION_DATE; out << _(", the command-line accounting tool"); out << - _("\n\nCopyright (c) 2003-2013, John Wiegley. All rights reserved.\n\n\ + _("\n\nCopyright (c) 2003-2015, John Wiegley. All rights reserved.\n\n\ This program is made available under the terms of the BSD Public License.\n\ See LICENSE file included with the distribution for details and disclaimer."); out << std::endl; diff --git a/src/history.cc b/src/history.cc index 93883ae0..e3c459f3 100644 --- a/src/history.cc +++ b/src/history.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/history.h b/src/history.h index fa69d8da..dd776383 100644 --- a/src/history.h +++ b/src/history.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/item.cc b/src/item.cc index a29a3fd3..9effcd23 100644 --- a/src/item.cc +++ b/src/item.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -191,7 +191,11 @@ public: static bool use_aux_date; virtual bool has_date() const { +#if BOOST_VERSION >= 105600 + return _date != NULL; +#else return _date; +#endif } virtual date_t date() const { diff --git a/src/iterators.cc b/src/iterators.cc index 738f33be..21bec5d9 100644 --- a/src/iterators.cc +++ b/src/iterators.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -204,9 +204,9 @@ void sorted_accounts_iterator::push_back(account_t& account) compare_items<account_t>(sort_cmp)); #if DEBUG_ON - if (SHOW_DEBUG("accounts.sorted")) { + if (SHOW_DEBUG("account.sorted")) { foreach (account_t * acct, accounts_list.back()) - DEBUG("accounts.sorted", + DEBUG("account.sorted", "Account (flat): " << acct->fullname()); } #endif @@ -237,9 +237,9 @@ void sorted_accounts_iterator::sort_accounts(account_t& account, compare_items<account_t>(sort_cmp)); #if DEBUG_ON - if (SHOW_DEBUG("accounts.sorted")) { + if (SHOW_DEBUG("account.sorted")) { foreach (account_t * acct, deque) - DEBUG("accounts.sorted", "Account: " << acct->fullname()); + DEBUG("account.sorted", "Account: " << acct->fullname()); } #endif } diff --git a/src/iterators.h b/src/iterators.h index 3ece313c..86eb86ca 100644 --- a/src/iterators.h +++ b/src/iterators.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/journal.cc b/src/journal.cc index 7eeaabe8..ae545477 100644 --- a/src/journal.cc +++ b/src/journal.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -95,7 +95,9 @@ void journal_t::initialize() force_checking = false; check_payees = false; day_break = false; - checking_style = CHECK_PERMISSIVE; + checking_style = CHECK_NORMAL; + recursive_aliases = false; + no_aliases = false; } void journal_t::add_account(account_t * acct) @@ -121,26 +123,9 @@ account_t * journal_t::find_account_re(const string& regexp) account_t * journal_t::register_account(const string& name, post_t * post, account_t * master_account) { - account_t * result = NULL; - - // If there any account aliases, substitute before creating an account + // If there are any account aliases, substitute before creating an account // object. - if (account_aliases.size() > 0) { - accounts_map::const_iterator i = account_aliases.find(name); - if (i != account_aliases.end()) { - result = (*i).second; - } else { - // only check the very first account for alias expansion, in case - // that can be expanded successfully - size_t colon = name.find(':'); - if(colon != string::npos) { - accounts_map::const_iterator j = account_aliases.find(name.substr(0, colon)); - if (j != account_aliases.end()) { - result = find_account((*j).second->fullname() + name.substr(colon)); - } - } - } - } + account_t * result = expand_aliases(name); // Create the account object and associate it with the journal; this // is registering the account. @@ -178,7 +163,63 @@ account_t * journal_t::register_account(const string& name, post_t * post, } } } + return result; +} + +account_t * journal_t::expand_aliases(string name) { + // Aliases are expanded recursively, so if both alias Foo=Bar:Foo and + // alias Bar=Baaz:Bar are in effect, first Foo will be expanded to Bar:Foo, + // then Bar:Foo will be expanded to Baaz:Bar:Foo. + // The expansion loop keeps a list of already expanded names in order to + // prevent infinite excursion. Each alias may only be expanded at most once. + account_t * result = NULL; + if (no_aliases) + return result; + + bool keep_expanding = true; + std::list<string> already_seen; + // loop until no expansion can be found + do { + if (account_aliases.size() > 0) { + accounts_map::const_iterator i = account_aliases.find(name); + if (i != account_aliases.end()) { + if (std::find(already_seen.begin(), already_seen.end(), name) != already_seen.end()) { + throw_(std::runtime_error, + _f("Infinite recursion on alias expansion for %1%") + % name); + } + // there is an alias for the full account name, including colons + already_seen.push_back(name); + result = (*i).second; + name = result->fullname(); + } else { + // only check the very first account for alias expansion, in case + // that can be expanded successfully + size_t colon = name.find(':'); + if (colon != string::npos) { + string first_account_name = name.substr(0, colon); + accounts_map::const_iterator j = account_aliases.find(first_account_name); + if (j != account_aliases.end()) { + if (std::find(already_seen.begin(), already_seen.end(), first_account_name) != already_seen.end()) { + throw_(std::runtime_error, + _f("Infinite recursion on alias expansion for %1%") + % first_account_name); + } + already_seen.push_back(first_account_name); + result = find_account((*j).second->fullname() + name.substr(colon)); + name = result->fullname(); + } else { + keep_expanding = false; + } + } else { + keep_expanding = false; + } + } + } else { + keep_expanding = false; + } + } while(keep_expanding && recursive_aliases); return result; } @@ -208,7 +249,7 @@ string journal_t::register_payee(const string& name, xact_t * xact) } } - foreach (payee_mapping_t& value, payee_mappings) { + foreach (payee_alias_mapping_t& value, payee_alias_mappings) { if (value.first.match(name)) { payee = value.second; break; @@ -323,6 +364,21 @@ namespace { } } +bool lt_posting_account(post_t * left, post_t * right) { + return left->account < right->account; +} + +bool is_equivalent_posting(post_t * left, post_t * right) +{ + if (left->account != right->account) + return false; + + if (left->amount != right->amount) + return false; + + return true; +} + bool journal_t::add_xact(xact_t * xact) { xact->journal = this; @@ -345,12 +401,54 @@ bool journal_t::add_xact(xact_t * xact) // will have been performed by extend_xact, so asserts can still be // applied to it. if (optional<value_t> ref = xact->get_tag(_("UUID"))) { + std::string uuid = ref->to_string(); std::pair<checksum_map_t::iterator, bool> result - = checksum_map.insert(checksum_map_t::value_type(ref->to_string(), xact)); + = checksum_map.insert(checksum_map_t::value_type(uuid, xact)); if (! result.second) { - // jww (2012-02-27): Confirm that the xact in - // (*result.first).second is exact match in its significant - // details to xact. + // This UUID has been seen before; apply any postings which the + // earlier version may have deferred. + foreach (post_t * post, xact->posts) { + account_t * acct = post->account; + if (acct->deferred_posts) { + auto i = acct->deferred_posts->find(uuid); + if (i != acct->deferred_posts->end()) { + for (post_t * rpost : (*i).second) + if (acct == rpost->account) + acct->add_post(rpost); + acct->deferred_posts->erase(i); + } + } + } + + xact_t * other = (*result.first).second; + + // Copy the two lists of postings (which should be relatively + // short), and make sure that the intersection is the empty set + // (i.e., that they are the same list). + std::vector<post_t *> this_posts(xact->posts.begin(), + xact->posts.end()); + std::sort(this_posts.begin(), this_posts.end(), + lt_posting_account); + std::vector<post_t *> other_posts(other->posts.begin(), + other->posts.end()); + std::sort(other_posts.begin(), other_posts.end(), + lt_posting_account); + bool match = std::equal(this_posts.begin(), this_posts.end(), + other_posts.begin(), is_equivalent_posting); + + if (! match || this_posts.size() != other_posts.size()) { + add_error_context(_("While comparing this previously seen transaction:")); + add_error_context(source_context(other->pos->pathname, + other->pos->beg_pos, + other->pos->end_pos, "> ")); + add_error_context(_("to this later transaction:")); + add_error_context(source_context(xact->pos->pathname, + xact->pos->beg_pos, + xact->pos->end_pos, "> ")); + throw_(std::runtime_error, + _f("Transactions with the same UUID must have equivalent postings")); + } + xact->journal = NULL; return false; } diff --git a/src/journal.h b/src/journal.h index 716e2910..613b2b96 100644 --- a/src/journal.h +++ b/src/journal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -58,15 +58,17 @@ class account_t; class parse_context_t; class parse_context_stack_t; -typedef std::list<xact_t *> xacts_list; -typedef std::list<auto_xact_t *> auto_xacts_list; -typedef std::list<period_xact_t *> period_xacts_list; -typedef std::pair<mask_t, string> payee_mapping_t; -typedef std::list<payee_mapping_t> payee_mappings_t; -typedef std::pair<mask_t, account_t *> account_mapping_t; -typedef std::list<account_mapping_t> account_mappings_t; -typedef std::map<string, account_t *> accounts_map; -typedef std::map<string, xact_t *> checksum_map_t; +typedef std::list<xact_t *> xacts_list; +typedef std::list<auto_xact_t *> auto_xacts_list; +typedef std::list<period_xact_t *> period_xacts_list; +typedef std::pair<mask_t, string> payee_alias_mapping_t; +typedef std::list<payee_alias_mapping_t> payee_alias_mappings_t; +typedef std::pair<string, string> payee_uuid_mapping_t; +typedef std::list<payee_uuid_mapping_t> payee_uuid_mappings_t; +typedef std::pair<mask_t, account_t *> account_mapping_t; +typedef std::list<account_mapping_t> account_mappings_t; +typedef std::map<string, account_t *> accounts_map; +typedef std::map<string, xact_t *> checksum_map_t; typedef std::multimap<string, expr_t::check_expr_pair> tag_check_exprs_map; @@ -115,33 +117,37 @@ public: #endif // HAVE_BOOST_SERIALIZATION }; - account_t * master; - account_t * bucket; - xacts_list xacts; - auto_xacts_list auto_xacts; - period_xacts_list period_xacts; - std::list<fileinfo_t> sources; - std::set<string> known_payees; - std::set<string> known_tags; - bool fixed_accounts; - bool fixed_payees; - bool fixed_commodities; - bool fixed_metadata; - bool was_loaded; - bool force_checking; - bool check_payees; - bool day_break; - payee_mappings_t payee_mappings; - account_mappings_t account_mappings; - accounts_map account_aliases; - account_mappings_t payees_for_unknown_accounts; - checksum_map_t checksum_map; - tag_check_exprs_map tag_check_exprs; - optional<expr_t> value_expr; - parse_context_t * current_context; + account_t * master; + account_t * bucket; + xacts_list xacts; + auto_xacts_list auto_xacts; + period_xacts_list period_xacts; + std::list<fileinfo_t> sources; + std::set<string> known_payees; + std::set<string> known_tags; + bool fixed_accounts; + bool fixed_payees; + bool fixed_commodities; + bool fixed_metadata; + bool was_loaded; + bool force_checking; + bool check_payees; + bool day_break; + bool recursive_aliases; + bool no_aliases; + payee_alias_mappings_t payee_alias_mappings; + payee_uuid_mappings_t payee_uuid_mappings; + account_mappings_t account_mappings; + accounts_map account_aliases; + account_mappings_t payees_for_unknown_accounts; + checksum_map_t checksum_map; + tag_check_exprs_map tag_check_exprs; + optional<expr_t> value_expr; + parse_context_t * current_context; enum checking_style_t { CHECK_PERMISSIVE, + CHECK_NORMAL, CHECK_WARNING, CHECK_ERROR } checking_style; @@ -167,6 +173,8 @@ public: account_t * find_account(const string& name, bool auto_create = true); account_t * find_account_re(const string& regexp); + account_t * expand_aliases(string name); + account_t * register_account(const string& name, post_t * post, account_t * master = NULL); string register_payee(const string& name, xact_t * xact); diff --git a/src/lookup.cc b/src/lookup.cc index 2a602569..6dbeb502 100644 --- a/src/lookup.cc +++ b/src/lookup.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/lookup.h b/src/lookup.h index ee80faac..fc7063ec 100644 --- a/src/lookup.h +++ b/src/lookup.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/main.cc b/src/main.cc index accae197..c26a280a 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/mask.cc b/src/mask.cc index 56ef02d1..29b53781 100644 --- a/src/mask.cc +++ b/src/mask.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/option.cc b/src/option.cc index 256ee45b..8c003e08 100644 --- a/src/option.cc +++ b/src/option.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/option.h b/src/option.h index fe3e257b..4646121d 100644 --- a/src/option.h +++ b/src/option.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -229,7 +229,7 @@ public: inline bool is_eq(const char * p, const char * n) { // Test whether p matches n, substituting - in p for _ in n. for (; *p && *n; p++, n++) { - if (! (*p == '-' && *n == '_' ) && *p != *n) + if (! (*p == '-' && *n == '_') && *p != *n) return false; } // Ignore any trailing underscore @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -43,7 +43,8 @@ namespace ledger { posts_to_org_table::posts_to_org_table(report_t& _report, const optional<string>& _prepend_format) - : report(_report), last_xact(NULL), last_post(NULL) + : report(_report), last_xact(NULL), last_post(NULL), + header_printed(false), first_report_title(true) { first_line_format.parse_format ("|%(format_date(date))" @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/output.cc b/src/output.cc index 77d28eed..ffd144e1 100644 --- a/src/output.cc +++ b/src/output.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -331,10 +331,10 @@ void report_tags::flush() void report_tags::operator()(post_t& post) { - if(post.metadata){ - foreach (const item_t::string_map::value_type& data, *post.metadata){ + if (post.metadata) { + foreach (const item_t::string_map::value_type& data, *post.metadata) { string tag=data.first; - if(report.HANDLED(values) && (data.second).first){ + if (report.HANDLED(values) && (data.second).first) { tag+=": "+ (data.second).first.get().to_string(); } std::map<string, std::size_t>::iterator i = tags.find(tag); diff --git a/src/output.h b/src/output.h index 31afbd13..ec7ec6c2 100644 --- a/src/output.h +++ b/src/output.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/parser.cc b/src/parser.cc index bcb23f48..8044338f 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/parser.h b/src/parser.h index 8cc8027f..e46fc719 100644 --- a/src/parser.h +++ b/src/parser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/pool.cc b/src/pool.cc index 2627c816..95c0f49d 100644 --- a/src/pool.cc +++ b/src/pool.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -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))) && @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/post.cc b/src/post.cc index 1a24429b..269e2e6c 100644 --- a/src/post.cc +++ b/src/post.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -60,6 +60,7 @@ public: #define POST_COST_FIXATED 0x0200 // cost is fixed using = indicator #define POST_COST_VIRTUAL 0x0400 // cost is virtualized: (@) #define POST_ANONYMIZED 0x0800 // a temporary, anonymous posting +#define POST_DEFERRED 0x1000 // the account was specified with <angles> xact_t * xact; // only set for posts of regular xacts account_t * account; @@ -67,6 +68,7 @@ public: amount_t amount; // can be null until finalization optional<expr_t> amount_expr; optional<amount_t> cost; + optional<amount_t> given_cost; optional<amount_t> assigned_amount; optional<datetime_t> checkin; optional<datetime_t> checkout; @@ -203,7 +205,11 @@ public: mutable optional<xdata_t> xdata_; bool has_xdata() const { +#if BOOST_VERSION >= 105600 + return xdata_ != NULL; +#else return xdata_; +#endif } void clear_xdata() { xdata_ = none; diff --git a/src/precmd.cc b/src/precmd.cc index e9c966e9..2da6ba8e 100644 --- a/src/precmd.cc +++ b/src/precmd.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/precmd.h b/src/precmd.h index 27925f42..bf2732d7 100644 --- a/src/precmd.h +++ b/src/precmd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/predicate.h b/src/predicate.h index 6a1cc01c..30d07223 100644 --- a/src/predicate.h +++ b/src/predicate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/print.cc b/src/print.cc index 0683f2e3..02e518f7 100644 --- a/src/print.cc +++ b/src/print.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -243,13 +243,21 @@ namespace { amtbuf << string(2 - (slip + amt_slip), ' '); amtbuf << amt; - if (post->cost && + if (post->given_cost && ! post->has_flags(POST_CALCULATED | POST_COST_CALCULATED)) { + std::string cost_op; if (post->has_flags(POST_COST_IN_FULL)) - amtbuf << " @@ " << post->cost->abs(); + cost_op = "@@"; else - amtbuf << " @ " - << (*post->cost / post->amount).abs(); + cost_op = "@"; + if (post->has_flags(POST_COST_VIRTUAL)) + cost_op = "(" + cost_op + ")"; + + if (post->has_flags(POST_COST_IN_FULL)) + amtbuf << " " << cost_op << " " << post->given_cost->abs(); + else + amtbuf << " " << cost_op << " " + << (*post->given_cost / post->amount).abs(); } if (post->assigned_amount) diff --git a/src/print.h b/src/print.h index 8d78e8cc..c587b499 100644 --- a/src/print.h +++ b/src/print.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/pstream.h b/src/pstream.h index 4886dc0b..3b669aca 100644 --- a/src/pstream.h +++ b/src/pstream.h @@ -1,9 +1,9 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * modification, are permitted provided that the following conditions are + * met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. @@ -83,7 +83,10 @@ class ptristream : public std::istream virtual pos_type seekoff(off_type off, ios_base::seekdir way, ios_base::openmode) { - switch (way) { + // cast to avoid gcc '-Wswitch' warning + // as ios_base::beg/cur/end are not necesssarily values of 'way' enum type ios_base::seekdir + // based on https://svn.boost.org/trac/boost/ticket/7644 + switch (static_cast<int>(way)) { case std::ios::cur: setg(ptr, gptr()+off, ptr+len); break; diff --git a/src/ptree.cc b/src/ptree.cc index e7afdcd1..3efe4451 100644 --- a/src/ptree.cc +++ b/src/ptree.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -80,7 +80,12 @@ void format_ptree::flush() switch (format) { case FORMAT_XML: +#if BOOST_VERSION >= 105600 + auto indented = property_tree::xml_writer_make_settings<std::string> (' ', 2); +#else property_tree::xml_writer_settings<char> indented(' ', 2); +#endif + property_tree::write_xml(out, pt, indented); out << std::endl; break; diff --git a/src/ptree.h b/src/ptree.h index 154c8837..36708dcf 100644 --- a/src/ptree.h +++ b/src/ptree.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/py_account.cc b/src/py_account.cc index fbd68140..1cc28b92 100644 --- a/src/py_account.cc +++ b/src/py_account.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -35,6 +35,7 @@ #include "pyutils.h" #include "account.h" #include "post.h" +#include "expr.h" namespace ledger { @@ -97,6 +98,26 @@ namespace { return str_to_py_unicode(account.fullname()); } + value_t py_amount_0(const account_t& account) + { + return account.amount(); + } + + value_t py_amount_1(const account_t& account, const boost::optional<expr_t&>& expr) + { + return account.amount(expr); + } + + value_t py_total_0(const account_t& account) + { + return account.total(); + } + + value_t py_total_1(const account_t& account, const boost::optional<expr_t&>& expr) + { + return account.total(expr); + } + } // unnamed namespace void export_account() @@ -221,8 +242,10 @@ void export_account() .def("xdata", py_xdata, return_internal_reference<>()) - .def("amount", &account_t::amount) - .def("total", &account_t::total) + .def("amount", py_amount_0) + .def("amount", py_amount_1, args("expr")) + .def("total", py_total_0) + .def("total", py_total_1, args("expr")) .def("self_details", &account_t::self_details, return_internal_reference<>()) diff --git a/src/py_amount.cc b/src/py_amount.cc index 50e16a70..84558a29 100644 --- a/src/py_amount.cc +++ b/src/py_amount.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/py_balance.cc b/src/py_balance.cc index 65e3c401..98ed8c60 100644 --- a/src/py_balance.cc +++ b/src/py_balance.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -56,6 +56,11 @@ namespace { const datetime_t& moment) { return balance.value(moment, in_terms_of); } + boost::optional<balance_t> py_value_2d(const balance_t& balance, + const commodity_t * in_terms_of, + const date_t& moment) { + return balance.value(datetime_t(moment), in_terms_of); + } boost::optional<amount_t> py_commodity_amount_0(const balance_t& balance) { @@ -64,7 +69,7 @@ namespace { boost::optional<amount_t> py_commodity_amount_1(const balance_t& balance, - const boost::optional<const commodity_t&>& commodity) { + const commodity_t& commodity) { return balance.commodity_amount(commodity); } @@ -200,6 +205,7 @@ void export_balance() .def("value", py_value_0) .def("value", py_value_1, args("in_terms_of")) .def("value", py_value_2, args("in_terms_of", "moment")) + .def("value", py_value_2d, args("in_terms_of", "moment")) .def("__nonzero__", &balance_t::is_nonzero) .def("is_nonzero", &balance_t::is_nonzero) diff --git a/src/py_commodity.cc b/src/py_commodity.cc index fd932fc7..27a0e105 100644 --- a/src/py_commodity.cc +++ b/src/py_commodity.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -315,6 +315,7 @@ void export_commodity() scope().attr("COMMODITY_STYLE_SUFFIXED") = COMMODITY_STYLE_SUFFIXED; scope().attr("COMMODITY_STYLE_SEPARATED") = COMMODITY_STYLE_SEPARATED; scope().attr("COMMODITY_STYLE_DECIMAL_COMMA") = COMMODITY_STYLE_DECIMAL_COMMA; + scope().attr("COMMODITY_STYLE_TIME_COLON") = COMMODITY_STYLE_TIME_COLON; scope().attr("COMMODITY_STYLE_THOUSANDS") = COMMODITY_STYLE_THOUSANDS; scope().attr("COMMODITY_NOMARKET") = COMMODITY_NOMARKET; scope().attr("COMMODITY_BUILTIN") = COMMODITY_BUILTIN; diff --git a/src/py_expr.cc b/src/py_expr.cc index c680bab4..803388f2 100644 --- a/src/py_expr.cc +++ b/src/py_expr.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/py_format.cc b/src/py_format.cc index 43266b29..6086d6cb 100644 --- a/src/py_format.cc +++ b/src/py_format.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/py_item.cc b/src/py_item.cc index 02b978c5..473bbef8 100644 --- a/src/py_item.cc +++ b/src/py_item.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/py_journal.cc b/src/py_journal.cc index 7cce6b11..abbcd866 100644 --- a/src/py_journal.cc +++ b/src/py_journal.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/py_post.cc b/src/py_post.cc index 6061d6ee..851828c7 100644 --- a/src/py_post.cc +++ b/src/py_post.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/py_session.cc b/src/py_session.cc index 7e2f9e8a..f6053180 100644 --- a/src/py_session.cc +++ b/src/py_session.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -61,6 +61,8 @@ void export_session() .def("read_journal_files", &session_t::read_journal_files, return_internal_reference<>()) .def("close_journal_files", &session_t::close_journal_files) + .def("journal", &session_t::get_journal, + return_internal_reference<>()) ; scope().attr("session") = diff --git a/src/py_times.cc b/src/py_times.cc index 599aa60c..906dcfaa 100644 --- a/src/py_times.cc +++ b/src/py_times.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -108,7 +108,7 @@ struct datetime_from_python static void* convertible(PyObject* obj_ptr) { MY_PyDateTime_IMPORT; - if(PyDateTime_Check(obj_ptr)) return obj_ptr; + if (PyDateTime_Check(obj_ptr)) return obj_ptr; return 0; } diff --git a/src/py_utils.cc b/src/py_utils.cc index dc572621..df87bded 100644 --- a/src/py_utils.cc +++ b/src/py_utils.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/py_value.cc b/src/py_value.cc index 8b565661..2828e3b8 100644 --- a/src/py_value.cc +++ b/src/py_value.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/py_xact.cc b/src/py_xact.cc index 0b07f582..5b4c14d4 100644 --- a/src/py_xact.cc +++ b/src/py_xact.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/pyfstream.h b/src/pyfstream.h index 12bbecfd..11f514a2 100644 --- a/src/pyfstream.h +++ b/src/pyfstream.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/pyinterp.cc b/src/pyinterp.cc index e15ff503..54e62946 100644 --- a/src/pyinterp.cc +++ b/src/pyinterp.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -34,6 +34,7 @@ #include "pyinterp.h" #include "pyutils.h" #include "account.h" +#include "report.h" #include "xact.h" #include "post.h" @@ -76,6 +77,12 @@ void initialize_for_python() export_xact(); export_session(); export_journal(); + + if (! scope_t::default_scope) { + python_session.reset(new ledger::python_interpreter_t); + shared_ptr<session_t> session_ptr = python_session; + scope_t::default_scope = new report_t(*session_ptr); + } } struct python_run diff --git a/src/pyinterp.h b/src/pyinterp.h index e961f4c0..32becbf6 100644 --- a/src/pyinterp.h +++ b/src/pyinterp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/pyledger.cc b/src/pyledger.cc index ee7b99c9..1f478dec 100644 --- a/src/pyledger.cc +++ b/src/pyledger.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/pyutils.h b/src/pyutils.h index 6bb9d0bd..039b2605 100644 --- a/src/pyutils.h +++ b/src/pyutils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/query.cc b/src/query.cc index 209205ae..04b18581 100644 --- a/src/query.cc +++ b/src/query.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/query.h b/src/query.h index 10820a59..b7608bc7 100644 --- a/src/query.h +++ b/src/query.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/quotes.cc b/src/quotes.cc index 2df51ec1..6d179287 100644 --- a/src/quotes.cc +++ b/src/quotes.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/quotes.h b/src/quotes.h index 813bdfa3..c14bc495 100644 --- a/src/quotes.h +++ b/src/quotes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/report.cc b/src/report.cc index 29077f10..4b240611 100644 --- a/src/report.cc +++ b/src/report.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -181,10 +181,17 @@ void report_t::normalize_options(const string& verb) } long cols = 0; +#if HAVE_IOCTL + struct winsize ws; +#endif if (HANDLED(columns_)) cols = lexical_cast<long>(HANDLER(columns_).value); else if (const char * columns = std::getenv("COLUMNS")) cols = lexical_cast<long>(columns); +#if HAVE_IOCTL + else if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1) + cols = ws.ws_col; +#endif else cols = 80L; @@ -1113,6 +1120,7 @@ option_t<report_t> * report_t::lookup_option(const char * p) OPT(csv_format_); else OPT_ALT(gain, change); else OPT(cleared); + else OPT(cleared_format_); else OPT(collapse); else OPT(collapse_if_zero); else OPT(color); @@ -1189,6 +1197,7 @@ option_t<report_t> * report_t::lookup_option(const char * p) case 'n': OPT_CH(collapse); else OPT(no_color); + else OPT(no_pager); else OPT(no_rounding); else OPT(no_titles); else OPT(no_total); diff --git a/src/report.h b/src/report.h index 5897e8f6..67e95884 100644 --- a/src/report.h +++ b/src/report.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -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); @@ -464,8 +465,8 @@ public: " 12 + 1 + 12 + 1 + 12, true, color))" " %(ansify_if(" " justify((get_at(display_total, 1) ? " - " (100% * scrub(get_at(display_total, 0))) / " - " -scrub(get_at(display_total, 1)) : 0), " + " (100% * quantity(scrub(get_at(display_total, 0)))) / " + " -quantity(scrub(get_at(display_total, 1))) : 0), " " 5, -1, true, false)," " magenta if (color and get_at(display_total, 1) and " " (abs(quantity(scrub(get_at(display_total, 0))) / " @@ -521,7 +522,7 @@ public: "%(quoted(code))," "%(quoted(payee))," "%(quoted(display_account))," - "%(quoted(commodity))," + "%(quoted(commodity(scrub(display_amount))))," "%(quoted(quantity(scrub(display_amount))))," "%(quoted(cleared ? \"*\" : (pending ? \"!\" : \"\")))," "%(quoted(join(note | xact.note)))\n"); diff --git a/src/scope.cc b/src/scope.cc index 10ae45a9..3ca9e0c0 100644 --- a/src/scope.cc +++ b/src/scope.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/scope.h b/src/scope.h index d6291439..8ad3afac 100644 --- a/src/scope.h +++ b/src/scope.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/select.cc b/src/select.cc index b7e4c920..81800f16 100644 --- a/src/select.cc +++ b/src/select.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -145,10 +145,17 @@ value_t select_command(call_scope_t& args) string thus_far = ""; std::size_t cols = 0; +#if HAVE_IOCTL + struct winsize ws; +#endif if (report.HANDLED(columns_)) cols = lexical_cast<std::size_t>(report.HANDLER(columns_).value); else if (const char * columns_env = std::getenv("COLUMNS")) cols = lexical_cast<std::size_t>(columns_env); +#if HAVE_IOCTL + else if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1) + cols = ws.ws_col; +#endif else cols = 80; @@ -291,17 +298,17 @@ value_t select_command(call_scope_t& args) thus_far += "int(payee_width) + 1"; } else if (ident == "account") { - formatter << "ansify_if(" - << "ansify_if("; + formatter << "ansify_if("; if (accounts_report) { + formatter << "ansify_if("; formatter << "partial_account(options.flat), blue if color),"; } else { formatter << "justify(truncated("; as_expr(column)->print(formatter); formatter << ", int(account_width), int(abbrev_len))," - << "int(account_width)),"; - formatter << "true, color),"; + << "int(account_width), -1, "; + formatter << "false, color),"; if (! thus_far.empty()) thus_far += " + "; @@ -358,10 +365,9 @@ value_t select_command(call_scope_t& args) formatter << ")"; } formatter << "\\n"; + DEBUG("select.parse", "formatter: " << formatter.str()); } else if (keyword == "from") { - DEBUG("select.parse", "formatter: " << formatter.str()); - if (arg == "xacts" || arg == "txns" || arg == "transactions") { report_functor = expr_t::op_t::wrap_functor (reporter<>(post_handler_ptr(new print_xacts(report, diff --git a/src/select.h b/src/select.h index 346067a2..c95e15f7 100644 --- a/src/select.h +++ b/src/select.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/session.cc b/src/session.cc index e5425a50..b0d31be9 100644 --- a/src/session.cc +++ b/src/session.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -93,25 +93,31 @@ std::size_t session_t::read_data(const string& master_account) acct = journal->find_account(master_account); optional<path> price_db_path; - if (HANDLED(price_db_)){ + if (HANDLED(price_db_)) { price_db_path = resolve_path(HANDLER(price_db_).str()); - if (!exists(price_db_path.get())){ + if (!exists(price_db_path.get())) { throw_(parse_error, _f("Could not find specified price-db file %1%") % price_db_path); } } else { - if (const char * home_var = std::getenv("HOME")){ + if (const char * home_var = std::getenv("HOME")) { price_db_path = (path(home_var) / ".pricedb"); } else { price_db_path = ("./.ledgerrc"); } } + if (HANDLED(day_break)) + journal->day_break = true; + + if (HANDLED(recursive_aliases)) + journal->recursive_aliases = true; + if (HANDLED(no_aliases)) + journal->no_aliases = true; + if (HANDLED(explicit)) journal->force_checking = true; if (HANDLED(check_payees)) journal->check_payees = true; - if (HANDLED(day_break)) - journal->day_break = true; if (HANDLED(permissive)) journal->checking_style = journal_t::CHECK_PERMISSIVE; @@ -119,8 +125,9 @@ std::size_t session_t::read_data(const string& master_account) journal->checking_style = journal_t::CHECK_ERROR; else if (HANDLED(strict)) journal->checking_style = journal_t::CHECK_WARNING; - else if (HANDLED(value_expr_)) - journal->value_expr = HANDLER(value_expr_).str(); + + if (HANDLED(value_expr_)) + journal->value_expr = HANDLER(value_expr_).str(); #if HAVE_BOOST_SERIALIZATION optional<archive_t> cache; @@ -258,6 +265,11 @@ void session_t::close_journal_files() amount_t::initialize(); } +journal_t * session_t::get_journal() +{ + return journal.get(); +} + value_t session_t::fn_account(call_scope_t& args) { if (args[0].is_string()) @@ -344,12 +356,18 @@ option_t<session_t> * session_t::lookup_option(const char * p) case 'm': OPT(master_account_); break; + case 'n': + OPT(no_aliases); + break; case 'p': OPT(price_db_); else OPT(price_exp_); else OPT(pedantic); else OPT(permissive); break; + case 'r': + OPT(recursive_aliases); + break; case 's': OPT(strict); break; diff --git a/src/session.h b/src/session.h index 21be3cc7..b287b19e 100644 --- a/src/session.h +++ b/src/session.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -84,6 +84,8 @@ public: journal_t * read_journal_files(); void close_journal_files(); + journal_t * get_journal(); + value_t fn_account(call_scope_t& scope); value_t fn_min(call_scope_t& scope); value_t fn_max(call_scope_t& scope); @@ -109,6 +111,8 @@ public: HANDLER(permissive).report(out); HANDLER(price_db_).report(out); HANDLER(price_exp_).report(out); + HANDLER(recursive_aliases).report(out); + HANDLER(no_aliases).report(out); HANDLER(strict).report(out); HANDLER(value_expr_).report(out); } @@ -164,6 +168,8 @@ public: OPTION(session_t, price_db_); OPTION(session_t, strict); OPTION(session_t, value_expr_); + OPTION(session_t, recursive_aliases); + OPTION(session_t, no_aliases); }; /** diff --git a/src/stats.cc b/src/stats.cc index 81d71a46..406ecd3b 100644 --- a/src/stats.cc +++ b/src/stats.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/stats.h b/src/stats.h index 5583e704..f0408591 100644 --- a/src/stats.h +++ b/src/stats.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/stream.cc b/src/stream.cc index c00c4cc5..c5a40e87 100644 --- a/src/stream.cc +++ b/src/stream.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -80,18 +80,10 @@ namespace { close(pfd[1]); close(pfd[0]); - // Find command name: its the substring starting right of the - // rightmost '/' character in the pager pathname. See manpage for - // strrchr. -#if BOOST_VERSION >= 103700 - path basename(pager_path.filename()); -#else - path basename(pager_path.leaf()); -#endif - execlp(pager_path.string().c_str(), basename.string().c_str(), NULL); + execlp("/bin/sh", "/bin/sh", "-c", pager_path.string().c_str(), NULL); // We should never, ever reach here - perror((std::string("execlp: ") + pager_path.string()).c_str()); + perror("execlp: /bin/sh"); exit(1); } else { // parent diff --git a/src/stream.h b/src/stream.h index bb63873a..05572cb4 100644 --- a/src/stream.h +++ b/src/stream.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/system.hh.in b/src/system.hh.in index ff7ea75b..21417e09 100644 --- a/src/system.hh.in +++ b/src/system.hh.in @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -56,8 +56,6 @@ #define Ledger_VERSION_PATCH @Ledger_VERSION_PATCH@ #define Ledger_VERSION_DATE @Ledger_VERSION_DATE@ -#define HAVE_CXX11 @HAVE_CXX11@ - #define HAVE_EDIT @HAVE_EDIT@ #define HAVE_GETTEXT @HAVE_GETTEXT@ @@ -65,6 +63,7 @@ #define HAVE_REALPATH @HAVE_REALPATH@ #define HAVE_GETPWUID @HAVE_GETPWUID@ #define HAVE_GETPWNAM @HAVE_GETPWNAM@ +#define HAVE_IOCTL @HAVE_IOCTL@ #define HAVE_ISATTY @HAVE_ISATTY@ #define HAVE_UNIX_PIPES @HAVE_UNIX_PIPES@ @@ -153,14 +152,18 @@ typedef std::ostream::pos_type ostream_pos_type; #include <pwd.h> #endif +#if HAVE_IOCTL +#include <sys/ioctl.h> +#endif + #if HAVE_UNIX_PIPES #include <sys/types.h> #include <sys/wait.h> #endif +#include <cstddef> /* needed for gcc 4.9 */ #include <gmp.h> #include <mpfr.h> -#include "sha1.h" #include "utf8.h" #if HAVE_EDIT diff --git a/src/temps.cc b/src/temps.cc index b4778b49..15ccbc3a 100644 --- a/src/temps.cc +++ b/src/temps.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/temps.h b/src/temps.h index 99110496..77a7824e 100644 --- a/src/temps.h +++ b/src/temps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/textual.cc b/src/textual.cc index 9e19ee37..8007ca0d 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -77,16 +77,18 @@ namespace { std::istream& in; instance_t * parent; std::list<application_t> apply_stack; + bool no_assertions; #if defined(TIMELOG_SUPPORT) time_log_t timelog; #endif instance_t(parse_context_stack_t& _context_stack, parse_context_t& _context, - instance_t * _parent = NULL) + instance_t * _parent = NULL, + const bool _no_assertions = false) : context_stack(_context_stack), context(_context), in(*context.stream.get()), parent(_parent), - timelog(context) {} + no_assertions(_no_assertions), timelog(context) {} virtual string description() { return _("textual parser"); @@ -153,6 +155,7 @@ namespace { void payee_directive(char * line); void payee_alias_directive(const string& payee, string alias); + void payee_uuid_directive(const string& payee, string uuid); void commodity_directive(char * line); void commodity_alias_directive(commodity_t& comm, string alias); @@ -282,6 +285,11 @@ void instance_t::parse() } } + if (apply_stack.front().value.type() == typeid(optional<datetime_t>)) + epoch = boost::get<optional<datetime_t> >(apply_stack.front().value); + + apply_stack.pop_front(); + #if defined(TIMELOG_SUPPORT) timelog.close(); #endif // TIMELOG_SUPPORT @@ -416,7 +424,9 @@ void instance_t::read_next_directive(bool& error_flag) price_xact_directive(line); break; case 'Y': // set the current year - apply_year_directive(line); + if (std::strlen(line+1) == 0) + throw_(parse_error, _f("Directive '%1%' requires an argument") % line[0]); + apply_year_directive(line+1); break; } } @@ -779,8 +789,8 @@ void instance_t::include_directive(char * line) context_stack.get_current().master = master; context_stack.get_current().scope = scope; try { - instance_t instance(context_stack, - context_stack.get_current(), this); + instance_t instance(context_stack, context_stack.get_current(), + this, no_assertions); instance.apply_stack.push_front(application_t("account", master)); instance.parse(); } @@ -860,14 +870,17 @@ void instance_t::apply_rate_directive(char * line) void instance_t::apply_year_directive(char * line) { - apply_stack.push_front(application_t("year", epoch)); - - // This must be set to the last day of the year, otherwise partial - // dates like "11/01" will refer to last year's november, not the - // current year. - unsigned short year(lexical_cast<unsigned short>(skip_ws(line + 1))); - DEBUG("times.epoch", "Setting current year to " << year); - epoch = datetime_t(date_t(year, 12, 31)); + try { + unsigned short year(lexical_cast<unsigned short>(skip_ws(line))); + apply_stack.push_front(application_t("year", epoch)); + DEBUG("times.epoch", "Setting current year to " << year); + // This must be set to the last day of the year, otherwise partial + // dates like "11/01" will refer to last year's november, not the + // current year. + epoch = datetime_t(date_t(year, 12, 31)); + } catch(bad_lexical_cast &) { + throw_(parse_error, _f("Argument '%1%' not a valid year") % skip_ws(line)); + } } void instance_t::end_apply_directive(char * kind) @@ -915,6 +928,10 @@ void instance_t::account_directive(char * line) char * b = next_element(q); string keyword(q); + // Ensure there's an argument for the directives that need one. + if (! b && keyword != "default") + throw_(parse_error, _f("Account directive '%1%' requires an argument") % keyword); + if (keyword == "alias") { account_alias_directive(account, b); } @@ -977,6 +994,11 @@ void instance_t::account_alias_directive(account_t * account, string alias) // (account), add a reference to the account in the `account_aliases' // map, which is used by the post parser to resolve alias references. trim(alias); + // Ensure that no alias like "alias Foo=Foo" is registered. + if ( alias == account->fullname()) { + throw_(parse_error, _f("Illegal alias %1%=%2%") + % alias % account->fullname()); + } std::pair<accounts_map::iterator, bool> result = context.journal->account_aliases.insert (accounts_map::value_type(alias, account)); @@ -1026,16 +1048,28 @@ void instance_t::payee_directive(char * line) char * b = next_element(p); string keyword(p); + if (! b) + throw_(parse_error, _f("Payee directive '%1%' requires an argument") % keyword); + if (keyword == "alias") payee_alias_directive(payee, b); + if (keyword == "uuid") + payee_uuid_directive(payee, b); } } void instance_t::payee_alias_directive(const string& payee, string alias) { trim(alias); - context.journal->payee_mappings - .push_back(payee_mapping_t(mask_t(alias), payee)); + context.journal->payee_alias_mappings + .push_back(payee_alias_mapping_t(mask_t(alias), payee)); +} + +void instance_t::payee_uuid_directive(const string& payee, string uuid) +{ + trim(uuid); + context.journal->payee_uuid_mappings + .push_back(payee_uuid_mapping_t(uuid, payee)); } void instance_t::commodity_directive(char * line) @@ -1056,6 +1090,10 @@ void instance_t::commodity_directive(char * line) char * b = next_element(q); string keyword(q); + // Ensure there's an argument for the directives that need one. + if (! b && keyword != "nomarket" && keyword != "default") + throw_(parse_error, _f("Commodity directive '%1%' requires an argument") % keyword); + if (keyword == "alias") commodity_alias_directive(*commodity, b); else if (keyword == "value") @@ -1217,13 +1255,13 @@ void instance_t::python_directive(char * line) void instance_t::import_directive(char *) { throw_(parse_error, - _("'python' directive seen, but Python support is missing")); + _("'import' directive seen, but Python support is missing")); } void instance_t::python_directive(char *) { throw_(parse_error, - _("'import' directive seen, but Python support is missing")); + _("'python' directive seen, but Python support is missing")); } #endif // HAVE_BOOST_PYTHON @@ -1240,6 +1278,14 @@ bool instance_t::general_directive(char * line) if (*p == '@' || *p == '!') p++; + // Ensure there's an argument for all directives that need one. + if (! arg && + std::strcmp(p, "comment") != 0 && std::strcmp(p, "end") != 0 + && std::strcmp(p, "python") != 0 && std::strcmp(p, "test") != 0 && + *p != 'Y') { + throw_(parse_error, _f("Directive '%1%' requires an argument") % p); + } + switch (*p) { case 'a': if (std::strcmp(p, "account") == 0) { @@ -1339,6 +1385,13 @@ bool instance_t::general_directive(char * line) return true; } break; + + case 'y': + if (std::strcmp(p, "year") == 0) { + apply_year_directive(arg); + return true; + } + break; } if (expr_t::ptr_op_t op = lookup(symbol_t::DIRECTIVE, p)) { @@ -1398,8 +1451,7 @@ post_t * instance_t::parse_post(char * line, } if (xact && - ((xact->_state == item_t::CLEARED && post->_state != item_t::CLEARED) || - (xact->_state == item_t::PENDING && post->_state == item_t::UNCLEARED))) + (xact->_state != item_t::UNCLEARED && post->_state == item_t::UNCLEARED)) post->set_state(xact->_state); // Parse the account name @@ -1425,6 +1477,12 @@ post_t * instance_t::parse_post(char * line, } p++; e--; } + else if (*p == '<' && *(e - 1) == '>') { + post->add_flags(POST_DEFERRED); + DEBUG("textual.parse", "line " << context.linenum << ": " + << "Parsed a deferred account name"); + p++; e--; + } string name(p, static_cast<string::size_type>(e - p)); DEBUG("textual.parse", "line " << context.linenum << ": " @@ -1490,13 +1548,12 @@ post_t * instance_t::parse_post(char * line, post->add_flags(POST_COST_IN_FULL); DEBUG("textual.parse", "line " << context.linenum << ": " << "And it's for a total price"); + next++; } - if (post->has_flags(POST_COST_VIRTUAL) && *(next + 1) == ')') + if (post->has_flags(POST_COST_VIRTUAL) && *next == ')') ++next; - beg = static_cast<std::streamsize>(++next - line); - p = skip_ws(next); if (*p) { post->cost = amount_t(); @@ -1538,6 +1595,8 @@ post_t * instance_t::parse_post(char * line, if (fixed_cost) post->add_flags(POST_COST_FIXATED); + post->given_cost = post->cost; + DEBUG("textual.parse", "line " << context.linenum << ": " << "Total cost is " << *post->cost); DEBUG("textual.parse", "line " << context.linenum << ": " @@ -1612,6 +1671,8 @@ post_t * instance_t::parse_post(char * line, break; } + amount_t tot = amt - diff; + DEBUG("post.assign", "line " << context.linenum << ": " << "diff = " << diff); DEBUG("textual.parse", "line " << context.linenum << ": " @@ -1620,8 +1681,10 @@ post_t * instance_t::parse_post(char * line, if (! diff.is_zero()) { if (! post->amount.is_null()) { diff -= post->amount; - if (! diff.is_zero()) - throw_(parse_error, _f("Balance assertion off by %1%") % diff); + if (! no_assertions && ! diff.is_zero()) + throw_(parse_error, + _f("Balance assertion off by %1% (expected to see %2%)") + % diff % tot); } else { post->amount = diff; DEBUG("textual.parse", "line " << context.linenum << ": " @@ -1770,7 +1833,7 @@ xact_t * instance_t::parse_xact(char * line, char *q = p - 1; while (q > next && std::isspace(*q)) --q; - if (q > next) + if (q >= next) *(q + 1) = '\0'; break; } @@ -1844,6 +1907,17 @@ xact_t * instance_t::parse_xact(char * line, else { reveal_context = false; + if (!last_post) { + if (xact->has_tag(_("UUID"))) { + string uuid = xact->get_tag(_("UUID"))->to_string(); + foreach (payee_uuid_mapping_t value, context.journal->payee_uuid_mappings) { + if (value.first.compare(uuid) == 0) { + xact->payee = value.second; + } + } + } + } + if (post_t * post = parse_post(p, len - (p - line), account, xact.get())) { reveal_context = true; @@ -1904,13 +1978,17 @@ std::size_t journal_t::read_textual(parse_context_stack_t& context_stack) { TRACE_START(parsing_total, 1, "Total time spent parsing text:"); { - instance_t instance(context_stack, context_stack.get_current()); + instance_t instance(context_stack, context_stack.get_current(), NULL, + checking_style == journal_t::CHECK_PERMISSIVE); instance.apply_stack.push_front (application_t("account", context_stack.get_current().master)); instance.parse(); } TRACE_STOP(parsing_total, 1); + // Apply any deferred postings at this time + master->apply_deferred_posts(); + // These tracers were started in textual.cc TRACE_FINISH(xact_text, 1); TRACE_FINISH(xact_details, 1); diff --git a/src/timelog.cc b/src/timelog.cc index 64017d50..91ee2697 100644 --- a/src/timelog.cc +++ b/src/timelog.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/timelog.h b/src/timelog.h index 1ce0be28..af621ee6 100644 --- a/src/timelog.h +++ b/src/timelog.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/times.cc b/src/times.cc index b1cb3494..b6c15dc3 100644 --- a/src/times.cc +++ b/src/times.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -839,6 +839,16 @@ void date_parser_t::determine_when(date_parser_t::lexer_t::token_t& tok, specifier.month = date_specifier_t::month_type (boost::get<date_time::months_of_year>(*tok.value)); + tok = lexer.peek_token(); + switch (tok.kind) { + case lexer_t::token_t::TOK_A_YEAR: + specifier.year = boost::get<date_specifier_t::year_type>(*tok.value); + break; + case lexer_t::token_t::END_REACHED: + break; + default: + break; + } break; case lexer_t::token_t::TOK_A_WDAY: specifier.wday = @@ -1802,6 +1812,7 @@ void times_initialize() readers.push_back(shared_ptr<date_io_t>(new date_io_t("%Y/%m/%d", true))); readers.push_back(shared_ptr<date_io_t>(new date_io_t("%Y/%m", true))); readers.push_back(shared_ptr<date_io_t>(new date_io_t("%y/%m/%d", true))); + readers.push_back(shared_ptr<date_io_t>(new date_io_t("%Y-%m-%d", true))); is_initialized = true; } diff --git a/src/times.h b/src/times.h index 4b89cc0c..c1bfb1cc 100644 --- a/src/times.h +++ b/src/times.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -568,7 +568,11 @@ public: void stabilize(const optional<date_t>& date = none); bool is_valid() const { +#if BOOST_VERSION >= 105600 + return start != NULL; +#else return start; +#endif } /** Find the current or next period containing date. Returns false if diff --git a/src/token.cc b/src/token.cc index d0ec185b..9fe7873f 100644 --- a/src/token.cc +++ b/src/token.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -522,7 +522,8 @@ void expr_t::token_t::expected(const char wanted, char c) void expr_t::token_t::expected(const kind_t wanted) { try { - if (wanted == '\0' || wanted == -1) + if (wanted == expr_t::token_t::ERROR || + wanted == expr_t::token_t::UNKNOWN) throw_(parse_error, _f("Invalid token '%1%'") % *this); else throw_(parse_error, diff --git a/src/token.h b/src/token.h index 51fa1d78..3fe249aa 100644 --- a/src/token.h +++ b/src/token.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/unistring.h b/src/unistring.h index eb38f8b1..3f459d83 100644 --- a/src/unistring.h +++ b/src/unistring.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -44,6 +44,8 @@ namespace ledger { +int mk_wcwidth(boost::uint32_t ucs); + /** * @class unistring * @@ -81,6 +83,14 @@ public: return utf32chars.size(); } + std::size_t width() const { + std::size_t width = 0; + foreach (const boost::uint32_t& ch, utf32chars) { + width += mk_wcwidth(ch); + } + return width; + } + std::string extract(const std::string::size_type begin = 0, const std::string::size_type len = 0) const { @@ -133,7 +143,7 @@ inline void justify(std::ostream& out, unistring temp(str); - int spacing = width - int(temp.length()); + int spacing = width - int(temp.width()); while (spacing-- > 0) out << ' '; diff --git a/src/utils.cc b/src/utils.cc index 4f810f93..9b528f54 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -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); @@ -566,7 +574,7 @@ std::ostream * _log_stream = &std::cerr; std::ostringstream _log_buffer; #if TRACING_ON -uint8_t _trace_level; +uint16_t _trace_level; #endif static bool logger_has_run = false; diff --git a/src/utils.h b/src/utils.h index c4d11636..b92a6f49 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -44,6 +44,8 @@ #ifndef _UTILS_H #define _UTILS_H +#include <boost/uuid/sha1.hpp> + /** * @name Default values */ @@ -249,7 +251,7 @@ void logger_func(log_level_t level); #if TRACING_ON -extern uint8_t _trace_level; +extern uint16_t _trace_level; #define SHOW_TRACE(lvl) \ (ledger::_log_level >= ledger::LOG_TRACE && lvl <= ledger::_trace_level) @@ -483,11 +485,7 @@ inline void check_for_signal() { /*@{*/ #define foreach BOOST_FOREACH -#if HAVE_CXX11 using std::unique_ptr; -#else -#define unique_ptr std::auto_ptr -#endif namespace ledger { @@ -625,11 +623,12 @@ inline string to_hex(unsigned int * message_digest, const int len = 1) inline string sha1sum(const string& str) { - SHA1 sha; - sha.Reset(); - sha << str.c_str(); + boost::uuids::detail::sha1 sha; + + sha.process_bytes(str.c_str(), str.length()); + unsigned int message_digest[5]; - sha.Result(message_digest); + sha.get_digest(message_digest); return to_hex(message_digest, 5); } diff --git a/src/value.cc b/src/value.cc index 98e48c2f..4ea7c7a8 100644 --- a/src/value.cc +++ b/src/value.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -341,6 +341,10 @@ value_t& value_t::operator+=(const value_t& val) } switch (type()) { + case VOID: + *this = value_t(val); + return *this; + case DATETIME: switch (val.type()) { case INTEGER: @@ -870,6 +874,8 @@ bool value_t::is_less_than(const value_t& val) const return as_long() < val.as_long(); case AMOUNT: return val.as_amount() > as_long(); + case BALANCE: + return val.to_amount() > as_long(); default: break; } @@ -886,6 +892,8 @@ bool value_t::is_less_than(const value_t& val) const return as_amount() < val.as_amount(); else return commodity_t::compare_by_commodity()(&as_amount(), &val.as_amount()); + case BALANCE: + return val.to_amount() > as_amount(); default: break; } @@ -904,6 +912,8 @@ bool value_t::is_less_than(const value_t& val) const } return ! no_amounts; } + case BALANCE: + return val.to_amount() > to_amount(); default: break; } @@ -990,6 +1000,8 @@ bool value_t::is_greater_than(const value_t& val) const return as_long() > val.as_long(); case AMOUNT: return val.as_amount() < as_long(); + case BALANCE: + return val.to_amount() < as_long(); default: break; } @@ -1001,6 +1013,8 @@ bool value_t::is_greater_than(const value_t& val) const return as_amount() > val.as_long(); case AMOUNT: return as_amount() > val.as_amount(); + case BALANCE: + return val.to_amount() < as_amount(); default: break; } @@ -1019,6 +1033,8 @@ bool value_t::is_greater_than(const value_t& val) const } return ! no_amounts; } + case BALANCE: + return val.to_amount() < to_amount(); default: break; } diff --git a/src/value.h b/src/value.h index 93760234..c224ce04 100644 --- a/src/value.h +++ b/src/value.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/views.cc b/src/views.cc index 2646e84b..61b824cd 100644 --- a/src/views.cc +++ b/src/views.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/views.h b/src/views.h index 94bedda5..2be3d978 100644 --- a/src/views.h +++ b/src/views.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/wcwidth.c.patch b/src/wcwidth.c.patch new file mode 100644 index 00000000..5864a056 --- /dev/null +++ b/src/wcwidth.c.patch @@ -0,0 +1,74 @@ +--- wcwidth.c 2007-05-26 18:06:24.000000000 +0800 ++++ wcwidth.cc 2014-02-13 18:36:18.668331252 +0800 +@@ -59,15 +59,23 @@ + * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c + */ + +-#include <wchar.h> ++/* This file is modified to work with C++ and present Unicode ++ * characters in uint32_t type. ++ */ ++ ++#include <system.hh> ++ ++namespace ledger { + +-struct interval { +- int first; +- int last; +-}; ++namespace { ++ struct interval { ++ int first; ++ int last; ++ }; ++} + + /* auxiliary function for binary search in interval table */ +-static int bisearch(wchar_t ucs, const struct interval *table, int max) { ++static int bisearch(boost::uint32_t ucs, const struct interval *table, int max) { + int min = 0; + int mid; + +@@ -119,7 +127,7 @@ + * in ISO 10646. + */ + +-int mk_wcwidth(wchar_t ucs) ++int mk_wcwidth(boost::uint32_t ucs) + { + /* sorted list of non-overlapping intervals of non-spacing characters */ + /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ +@@ -204,7 +212,7 @@ + } + + +-int mk_wcswidth(const wchar_t *pwcs, size_t n) ++int mk_wcswidth(const boost::uint32_t *pwcs, size_t n) + { + int w, width = 0; + +@@ -227,7 +235,7 @@ + * the traditional terminal character-width behaviour. It is not + * otherwise recommended for general use. + */ +-int mk_wcwidth_cjk(wchar_t ucs) ++int mk_wcwidth_cjk(boost::uint32_t ucs) + { + /* sorted list of non-overlapping intervals of East Asian Ambiguous + * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ +@@ -295,7 +303,7 @@ + } + + +-int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) ++int mk_wcswidth_cjk(const boost::uint32_t *pwcs, size_t n) + { + int w, width = 0; + +@@ -307,3 +315,5 @@ + + return width; + } ++ ++} // namespace ledger diff --git a/src/wcwidth.cc b/src/wcwidth.cc new file mode 100644 index 00000000..c23f83d7 --- /dev/null +++ b/src/wcwidth.cc @@ -0,0 +1,319 @@ +/* + * This is an implementation of wcwidth() and wcswidth() (defined in + * IEEE Std 1002.1-2001) for Unicode. + * + * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html + * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html + * + * In fixed-width output devices, Latin characters all occupy a single + * "cell" position of equal width, whereas ideographic CJK characters + * occupy two such cells. Interoperability between terminal-line + * applications and (teletype-style) character terminals using the + * UTF-8 encoding requires agreement on which character should advance + * the cursor by how many cell positions. No established formal + * standards exist at present on which Unicode character shall occupy + * how many cell positions on character terminals. These routines are + * a first attempt of defining such behavior based on simple rules + * applied to data provided by the Unicode Consortium. + * + * For some graphical characters, the Unicode standard explicitly + * defines a character-cell width via the definition of the East Asian + * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes. + * In all these cases, there is no ambiguity about which width a + * terminal shall use. For characters in the East Asian Ambiguous (A) + * class, the width choice depends purely on a preference of backward + * compatibility with either historic CJK or Western practice. + * Choosing single-width for these characters is easy to justify as + * the appropriate long-term solution, as the CJK practice of + * displaying these characters as double-width comes from historic + * implementation simplicity (8-bit encoded characters were displayed + * single-width and 16-bit ones double-width, even for Greek, + * Cyrillic, etc.) and not any typographic considerations. + * + * Much less clear is the choice of width for the Not East Asian + * (Neutral) class. Existing practice does not dictate a width for any + * of these characters. It would nevertheless make sense + * typographically to allocate two character cells to characters such + * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be + * represented adequately with a single-width glyph. The following + * routines at present merely assign a single-cell width to all + * neutral characters, in the interest of simplicity. This is not + * entirely satisfactory and should be reconsidered before + * establishing a formal standard in this area. At the moment, the + * decision which Not East Asian (Neutral) characters should be + * represented by double-width glyphs cannot yet be answered by + * applying a simple rule from the Unicode database content. Setting + * up a proper standard for the behavior of UTF-8 character terminals + * will require a careful analysis not only of each Unicode character, + * but also of each presentation form, something the author of these + * routines has avoided to do so far. + * + * http://www.unicode.org/unicode/reports/tr11/ + * + * Markus Kuhn -- 2007-05-26 (Unicode 5.0) + * + * Permission to use, copy, modify, and distribute this software + * for any purpose and without fee is hereby granted. The author + * disclaims all warranties with regard to this software. + * + * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c + */ + +/* This file is modified to work with C++ and present Unicode + * characters in uint32_t type. + */ + +#include <system.hh> + +namespace ledger { + +namespace { + struct interval { + boost::uint32_t first; + boost::uint32_t last; + }; +} + +/* auxiliary function for binary search in interval table */ +static int bisearch(boost::uint32_t ucs, const struct interval *table, int max) { + int min = 0; + int mid; + + if (ucs < table[0].first || ucs > table[max].last) + return 0; + while (max >= min) { + mid = (min + max) / 2; + if (ucs > table[mid].last) + min = mid + 1; + else if (ucs < table[mid].first) + max = mid - 1; + else + return 1; + } + + return 0; +} + + +/* The following two functions define the column width of an ISO 10646 + * character as follows: + * + * - The null character (U+0000) has a column width of 0. + * + * - Other C0/C1 control characters and DEL will lead to a return + * value of -1. + * + * - Non-spacing and enclosing combining characters (general + * category code Mn or Me in the Unicode database) have a + * column width of 0. + * + * - SOFT HYPHEN (U+00AD) has a column width of 1. + * + * - Other format characters (general category code Cf in the Unicode + * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. + * + * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) + * have a column width of 0. + * + * - Spacing characters in the East Asian Wide (W) or East Asian + * Full-width (F) category as defined in Unicode Technical + * Report #11 have a column width of 2. + * + * - All remaining characters (including all printable + * ISO 8859-1 and WGL4 characters, Unicode control characters, + * etc.) have a column width of 1. + * + * This implementation assumes that wchar_t characters are encoded + * in ISO 10646. + */ + +int mk_wcwidth(boost::uint32_t ucs) +{ + /* sorted list of non-overlapping intervals of non-spacing characters */ + /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ + static const struct interval combining[] = { + { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, + { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, + { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, + { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, + { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, + { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, + { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, + { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, + { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, + { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, + { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, + { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, + { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, + { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, + { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, + { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, + { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, + { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, + { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, + { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, + { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, + { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, + { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, + { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, + { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, + { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, + { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, + { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, + { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, + { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, + { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, + { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, + { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, + { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, + { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, + { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, + { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, + { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, + { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, + { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, + { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, + { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, + { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, + { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, + { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, + { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, + { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, + { 0xE0100, 0xE01EF } + }; + + /* test for 8-bit control characters */ + if (ucs == 0) + return 0; + if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) + return -1; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, combining, + sizeof(combining) / sizeof(struct interval) - 1)) + return 0; + + /* if we arrive here, ucs is not a combining or C0/C1 control character */ + + return 1 + + (ucs >= 0x1100 && + (ucs <= 0x115f || /* Hangul Jamo init. consonants */ + ucs == 0x2329 || ucs == 0x232a || + (ucs >= 0x2e80 && ucs <= 0xa4cf && + ucs != 0x303f) || /* CJK ... Yi */ + (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ + (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ + (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */ + (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ + (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */ + (ucs >= 0xffe0 && ucs <= 0xffe6) || + (ucs >= 0x20000 && ucs <= 0x2fffd) || + (ucs >= 0x30000 && ucs <= 0x3fffd))); +} + + +int mk_wcswidth(const boost::uint32_t *pwcs, size_t n) +{ + int w, width = 0; + + for (;*pwcs && n-- > 0; pwcs++) + if ((w = mk_wcwidth(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} + + +/* + * The following functions are the same as mk_wcwidth() and + * mk_wcswidth(), except that spacing characters in the East Asian + * Ambiguous (A) category as defined in Unicode Technical Report #11 + * have a column width of 2. This variant might be useful for users of + * CJK legacy encodings who want to migrate to UCS without changing + * the traditional terminal character-width behaviour. It is not + * otherwise recommended for general use. + */ +int mk_wcwidth_cjk(boost::uint32_t ucs) +{ + /* sorted list of non-overlapping intervals of East Asian Ambiguous + * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ + static const struct interval ambiguous[] = { + { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, + { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, + { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, + { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, + { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, + { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, + { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, + { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, + { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, + { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, + { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, + { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, + { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, + { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, + { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, + { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, + { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, + { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, + { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, + { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, + { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, + { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, + { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, + { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, + { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, + { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, + { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, + { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, + { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, + { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, + { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, + { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, + { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, + { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, + { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, + { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, + { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, + { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, + { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, + { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, + { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B }, + { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 }, + { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, + { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, + { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, + { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, + { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 }, + { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, + { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, + { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, + { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF }, + { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } + }; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, ambiguous, + sizeof(ambiguous) / sizeof(struct interval) - 1)) + return 2; + + return mk_wcwidth(ucs); +} + + +int mk_wcswidth_cjk(const boost::uint32_t *pwcs, size_t n) +{ + int w, width = 0; + + for (;*pwcs && n-- > 0; pwcs++) + if ((w = mk_wcwidth_cjk(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} + +} // namespace ledger diff --git a/src/xact.cc b/src/xact.cc index 7ea15322..5369c138 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -185,7 +185,7 @@ bool xact_base_t::finalize() if (post_account_bad || null_post_account_bad) throw_(std::logic_error, - _f("Posting with null amount's account may be mispelled:\n \"%1%\"") + _f("Posting with null amount's account may be misspelled:\n \"%1%\"") % (post_account_bad ? post->account->fullname() : null_post->account->fullname())); else @@ -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()) { @@ -304,10 +304,9 @@ bool xact_base_t::finalize() DEBUG("xact.finalize", "gain_loss = " << gain_loss); gain_loss.in_place_round(); DEBUG("xact.finalize", "gain_loss rounds to = " << gain_loss); - if (post->must_balance()) add_or_set_value(balance, gain_loss.reduced()); - +#if 0 account_t * account; if (gain_loss.sign() > 0) account = journal->find_account(_("Equity:Capital Gains")); @@ -321,6 +320,9 @@ bool xact_base_t::finalize() p->add_flags(post->flags() & (POST_VIRTUAL | POST_MUST_BALANCE)); } add_post(p); +#else + *post->cost += gain_loss; +#endif DEBUG("xact.finalize", "added gain_loss, balance = " << balance); } else { DEBUG("xact.finalize", "gain_loss would have displayed as zero"); @@ -393,7 +395,10 @@ bool xact_base_t::finalize() some_null = true; } - post->account->add_post(post); + if (post->has_flags(POST_DEFERRED)) + post->account->add_deferred_post(id(), post); + else + post->account->add_post(post); post->xdata().add_flags(POST_EXT_VISITED); post->account->xdata().add_flags(ACCOUNT_EXT_VISITED); @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013, John Wiegley. All rights reserved. + * Copyright (c) 2003-2015, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 94ce0a0a..44db81fb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,31 +1,29 @@ include(ProcessorCount) ProcessorCount(PROCESSORS) -if(NOT PROCESSORS EQUAL 0) +if (NOT PROCESSORS EQUAL 0) math(EXPR JOBS "${PROCESSORS} * 2") set(CTEST_BUILD_FLAGS -j${JOBS}) endif() -get_target_property(LEDGER_LOCATION ledger LOCATION) - add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} ${CTEST_BUILD_FLAGS}) add_subdirectory(unit) -if(HAVE_BOOST_PYTHON) +if (HAVE_BOOST_PYTHON) set(TEST_PYTHON_FLAGS "--python") endif() macro(add_ledger_harness_tests _class) - if(PYTHONINTERP_FOUND) + if (PYTHONINTERP_FOUND) file(GLOB ${_class}_TESTS *.test) foreach(TestFile ${${_class}_TESTS}) get_filename_component(TestFile_Name ${TestFile} NAME_WE) string(FIND ${TestFile_Name} "_py" TestFile_IsPythonTest) - if((TestFile_IsPythonTest EQUAL -1) OR HAVE_BOOST_PYTHON) - add_test(${_class}Test_${TestFile_Name} - ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/RegressTests.py - ${LEDGER_LOCATION} ${PROJECT_SOURCE_DIR} + if ((TestFile_IsPythonTest EQUAL -1) OR HAVE_BOOST_PYTHON) + add_test(NAME ${_class}Test_${TestFile_Name} + COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/RegressTests.py + $<TARGET_FILE:ledger> ${PROJECT_SOURCE_DIR} ${TestFile} ${TEST_PYTHON_FLAGS}) set_target_properties(check PROPERTIES DEPENDS ${_class}Test_${TestFile_Name}) @@ -38,4 +36,16 @@ add_subdirectory(manual) add_subdirectory(baseline) add_subdirectory(regress) +if (PYTHONINTERP_FOUND) + set(_class DocTests) + file(GLOB ${_class}_TESTS ${PROJECT_SOURCE_DIR}/doc/*.texi) + foreach(TestFile ${${_class}_TESTS}) + get_filename_component(TestFile_Name ${TestFile} NAME_WE) + add_test(NAME ${_class}Test_${TestFile_Name} + COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/DocTests.py + --ledger $<TARGET_FILE:ledger> --file ${TestFile}) + set_target_properties(check PROPERTIES DEPENDS ${_class}Test_${TestFile_Name}) + endforeach() +endif() + ### CMakeLists.txt ends here diff --git a/test/DocTests.py b/test/DocTests.py new file mode 100755 index 00000000..ea32608e --- /dev/null +++ b/test/DocTests.py @@ -0,0 +1,251 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import re +import sys +import hashlib +import argparse +import subprocess + +from difflib import unified_diff + +class DocTests: + def __init__(self, args): + scriptpath = os.path.dirname(os.path.realpath(__file__)) + self.ledger = os.path.abspath(args.ledger) + self.sourcepath = os.path.abspath(args.file) + self.verbose = args.verbose + self.tests = args.examples + + self.examples = dict() + self.test_files = list() + self.testin_token = 'command' + self.testout_token = 'output' + self.testdat_token = 'input' + self.validate_token = 'validate' + self.testwithdat_token = 'with_input' + + def read_example(self): + endexample = re.compile(r'^@end\s+smallexample\s*$') + example = str() + while True: + line = self.file.readline() + self.current_line += 1 + if len(line) <= 0 or endexample.match(line): break + example += line.replace("@@","@").replace("@{","{").replace("@}","}") + return example + + def test_id(self, example): + return hashlib.sha1(example.rstrip()).hexdigest()[0:7].upper() + + def find_examples(self): + startexample = re.compile(r'^@smallexample\s+@c\s+(%s|%s|%s)(?::([\dA-Fa-f]+|validate))?(?:,(.*))?' + % (self.testin_token, self.testout_token, self.testdat_token)) + while True: + line = self.file.readline() + self.current_line += 1 + if len(line) <= 0: break + + startmatch = startexample.match(line) + if (startmatch): + test_begin_pos = self.file.tell() + test_begin_line = self.current_line + test_kind = startmatch.group(1) + test_id = startmatch.group(2) + test_options = dict() + for pair in re.split(r',\s*', str(startmatch.group(3))): + kv = re.split(r':\s*', pair, 2) + try: + test_options[kv[0]] = kv[1] + except IndexError: + pass + example = self.read_example() + test_end_pos = self.file.tell() + test_end_line = self.current_line + + if not test_id: + print >> sys.stderr, 'Example', test_kind, 'in line', test_begin_line, 'is missing id.' + test_id = self.test_id(example) + if test_kind == self.testin_token: + print >> sys.stderr, 'Use', self.test_id(example) + elif test_kind == self.testin_token and test_id != self.validate_token and test_id != self.test_id(example): + print >> sys.stderr, 'Expected test id', test_id, 'for example' \ + , test_kind, 'on line', test_begin_line, 'to be', self.test_id(example) + + if test_id == self.validate_token: + test_id = "Val-" + str(test_begin_line) + if test_kind == self.testin_token: + test_kind = "validate-command" + elif test_kind == self.testdat_token: + test_kind = "validate-data" + try: + self.examples[test_id] + except KeyError: + self.examples[test_id] = dict() + + try: + example = self.examples[test_id][test_kind][test_kind] + example + except KeyError: + pass + + self.examples[test_id][test_kind] = { + 'bpos': test_begin_pos, + 'epos': test_end_pos, + 'blin': test_begin_line, + 'elin': test_end_line, + 'opts': test_options, + test_kind: example, + } + + def parse_command(self, test_id, example): + validate_command = False + try: + command = example[self.testin_token][self.testin_token] + except KeyError: + if 'validate-data' in example: + command = '$ ledger bal' + elif 'validate-command' in example: + validate_command = True + command = example['validate-command']['validate-command'] + else: + return None + + command = command.rstrip().split() + if command[0] == '$': command.remove('$') + index = command.index('ledger') + command[index] = self.ledger + for i,argument in enumerate('--args-only --columns 80'.split()): + command.insert(index+i+1, argument) + + try: + findex = command.index('-f') + except ValueError: + try: + findex = command.index('--file') + except ValueError: + findex = index+1 + command.insert(findex, '--file') + if validate_command: + command.insert(findex+1, 'sample.dat') + else: + command.insert(findex+1, test_id + '.dat') + return (command, findex+1) + + def test_examples(self): + failed = set() + tests = self.examples.keys() + if self.tests: + tests = list(set(self.tests).intersection(tests)) + temp = list(set(self.tests).difference(tests)) + if len(temp) > 0: + print >> sys.stderr, 'Skipping non-existent examples: %s' % ', '.join(temp) + + for test_id in tests: + validation = False + if "validate-data" in self.examples[test_id] or "validate-command" in self.examples[test_id]: + validation = True + example = self.examples[test_id] + try: + (command, findex) = self.parse_command(test_id, example) + except TypeError: + failed.add(test_id) + continue + + try: + output = example[self.testout_token][self.testout_token] + except KeyError: + output = None + + try: + input = example[self.testdat_token][self.testdat_token] + except KeyError: + try: + with_input = example[self.testin_token]['opts'][self.testwithdat_token] + input = self.examples[with_input][self.testdat_token][self.testdat_token] + except KeyError: + try: + input = example['validate-data']['validate-data'] + except KeyError: + input = None + + if command and (output or validation): + test_file_created = False + if findex: + scriptpath = os.path.dirname(os.path.realpath(__file__)) + test_input_dir = scriptpath + '/../test/input/' + test_file = command[findex] + if not os.path.exists(test_file): + if input: + test_file_created = True + with open(test_file, 'w') as f: + f.write(input) + elif os.path.exists(test_input_dir + test_file): + command[findex] = test_input_dir + test_file + error = False + try: + verify = subprocess.check_output(command) + except: + verify = str() + error = True + valid = (output == verify) or (not error and validation) + if valid and test_file_created: + os.remove(test_file) + if self.verbose > 0: + print test_id, ':', 'Passed' if valid else 'FAILED' + else: + sys.stdout.write('.' if valid else 'E') + + if not valid: + failed.add(test_id) + if self.verbose > 1: + print ' '.join(command) + if not validation: + for line in unified_diff(output.split('\n'), verify.split('\n'), fromfile='generated', tofile='expected'): + print(line) + print + if not self.verbose: + print + if len(failed) > 0: + print "\nThe following examples failed:" + print " ", "\n ".join(failed) + return len(failed) + + def main(self): + self.file = open(self.sourcepath) + self.current_line = 0 + self.find_examples() + failed_examples = self.test_examples() + self.file.close() + return failed_examples + +if __name__ == "__main__": + def getargs(): + parser = argparse.ArgumentParser(prog='DocTests', description='Test ledger examples from the documentation', prefix_chars='-') + parser.add_argument('-v', '--verbose', + dest='verbose', + action='count', + help='be verbose. Add -vv for more verbosity') + parser.add_argument('-l', '--ledger', + dest='ledger', + type=str, + action='store', + required=True, + help='the path to the ledger executable to test with') + parser.add_argument('-f', '--file', + dest='file', + type=str, + action='store', + required=True, + help='the texinfo documentation file to run the examples from') + parser.add_argument('examples', + metavar='EXAMPLE', + type=str, + nargs='*', + help='the examples to test') + return parser.parse_args() + + args = getargs() + script = DocTests(args) + status = script.main() + sys.exit(status) diff --git a/test/baseline/cmd-equity.test b/test/baseline/cmd-equity.test new file mode 100644 index 00000000..faffc085 --- /dev/null +++ b/test/baseline/cmd-equity.test @@ -0,0 +1,58 @@ +D 1000.00 GBP + +2011-03-04 Buy shares + Assets:Broker 2 AAA @ 0.90 GBP + Assets:Bank + +2011-03-05 Buy shares + Assets:Broker 2 AAA @ 1.00 GBP + Assets:Bank + +test equity +2011/03/05 Opening Balances + Assets:Bank -3.80 GBP + Assets:Broker 4 AAA + Equity:Opening Balances -4 AAA + Equity:Opening Balances 3.80 GBP +end test + +test equity assets +2011/03/05 Opening Balances + Assets:Bank -3.80 GBP + Assets:Broker 4 AAA + Equity:Opening Balances -4 AAA + Equity:Opening Balances 3.80 GBP +end test + +test equity assets:bank +2011/03/05 Opening Balances + Assets:Bank -3.80 GBP + Equity:Opening Balances +end test + +test equity assets:broker +2011/03/05 Opening Balances + Assets:Broker 4 AAA + Equity:Opening Balances +end test + +test equity --lot-prices +2011/03/05 Opening Balances + Assets:Bank -3.80 GBP + Assets:Broker 2 AAA {0.90 GBP} + Assets:Broker 2 AAA {1.00 GBP} + Equity:Opening Balances -2 AAA {0.90 GBP} + Equity:Opening Balances -2 AAA {1.00 GBP} + Equity:Opening Balances 3.80 GBP +end test + +test equity --lots --date-format %Y/%m/%d +2011/03/05 Opening Balances + Assets:Bank -3.80 GBP + Assets:Broker 2 AAA {0.90 GBP} [2011/03/04] + Assets:Broker 2 AAA {1.00 GBP} [2011/03/05] + Equity:Opening Balances -2 AAA {0.90 GBP} [2011/03/04] + Equity:Opening Balances -2 AAA {1.00 GBP} [2011/03/05] + Equity:Opening Balances 3.80 GBP +end test + diff --git a/test/baseline/cmd-select.test b/test/baseline/cmd-select.test index c8ce7008..67ce70f2 100644 --- a/test/baseline/cmd-select.test +++ b/test/baseline/cmd-select.test @@ -16,32 +16,32 @@ F test select "date, account, amount" from posts -12-Feb-28 E [0m 20.00 EUR -12-Feb-28 F [0m -20.00 EUR -12-Feb-29 Test [0m 10.01 EUR -12-Feb-29 F [0m -10.01 EUR -12-Mar-24 C [0m 30.00 EUR -12-Mar-24 D [0m -30.00 EUR -12-Mar-25 E [0m 40.00 GBP -12-Mar-25 F [0m -40.00 GBP +12-Feb-28 E 20.00 EUR +12-Feb-28 F -20.00 EUR +12-Feb-29 Test 10.01 EUR +12-Feb-29 F -10.01 EUR +12-Mar-24 C 30.00 EUR +12-Mar-24 D -30.00 EUR +12-Mar-25 E 40.00 GBP +12-Mar-25 F -40.00 GBP end test test select "date, account, amount from posts where account =~ /^e/" -12-Feb-28 E [0m 20.00 EUR -12-Mar-25 E [0m 40.00 GBP +12-Feb-28 E 20.00 EUR +12-Mar-25 E 40.00 GBP end test test select "date, account, amount from posts where account =~ /e/" -12-Feb-28 E [0m 20.00 EUR -12-Feb-29 Test [0m 10.01 EUR -12-Mar-25 E [0m 40.00 GBP +12-Feb-28 E 20.00 EUR +12-Feb-29 Test 10.01 EUR +12-Mar-25 E 40.00 GBP end test ; leave out "from posts" since it is the default test select "date, account, amount where account =~ /e/" -12-Feb-28 E [0m 20.00 EUR -12-Feb-29 Test [0m 10.01 EUR -12-Mar-25 E [0m 40.00 GBP +12-Feb-28 E 20.00 EUR +12-Feb-29 Test 10.01 EUR +12-Mar-25 E 40.00 GBP end test test select "date, payee, amount from posts where account =~ /e/ and commodity =~ /GBP/" diff --git a/test/baseline/cmd-source.test b/test/baseline/cmd-source.test index 95a10924..6d12719c 100644 --- a/test/baseline/cmd-source.test +++ b/test/baseline/cmd-source.test @@ -28,29 +28,29 @@ test source -> 7 __ERROR__ -While parsing file "$FILE", line 1: +While parsing file "$FILE", line 1: While parsing periodic transaction: > ~ xxx Error: Unexpected date period token 'xxx' -While parsing file "$FILE", line 6: +While parsing file "$FILE", line 6: Error: Only one posting with null amount allowed per transaction -While parsing file "$FILE", line 11: +While parsing file "$FILE", line 11: Error: Only one posting with null amount allowed per transaction -While parsing file "$FILE", line 13: +While parsing file "$FILE", line 13: While parsing transaction: > 2012/03/xx Error: Invalid date: 2012/03/xx -While parsing file "$FILE", line 18: +While parsing file "$FILE", line 18: While parsing posting: G AAA ^^^ Error: No quantity specified for amount -While parsing file "$FILE", line 22: +While parsing file "$FILE", line 22: While parsing posting: I 1,00.00 EUR ^^^^^^^^^^^ Error: Incorrect use of thousand-mark comma -While parsing file "$FILE", line 27: +While parsing file "$FILE", line 27: While balancing transaction from "$FILE", lines 25-27: > 2012-03-27 * Test > K 100.00 EUR diff --git a/test/baseline/cmd-tags.test b/test/baseline/cmd-tags.test new file mode 100644 index 00000000..bfff763a --- /dev/null +++ b/test/baseline/cmd-tags.test @@ -0,0 +1,55 @@ + +2014-01-01 * Test 1 + A $10 ; :bar: + B ; :foo: + +2014-01-02 * Test 2 + A $10 ; :a: + B + +2014-01-03 * Test 3 + A $10 + B ; :b: + +2014-01-03 * Test 4 + ; :xxx: + A $10 + B + +2014-01-03 * Test 5 + A $10 ; a: aaa + B + +2014-02-04 * Test 6 + A $10 ; a: aaa + B + +2014-01-01 * Test 7 + A $10 + B ; b: bbb + +test tags +a +b +bar +foo +end test + +test tags --values +a +a: aaa +b +b: bbb +bar +foo +end test + +test tags --values --count +1 a +2 a: aaa +1 b +1 b: bbb +1 bar +1 foo +end test + diff --git a/test/baseline/dir-account.test b/test/baseline/dir-account.test index e8c3fc54..f5a5a3c8 100644 --- a/test/baseline/dir-account.test +++ b/test/baseline/dir-account.test @@ -1,5 +1,3 @@ ---explicit ---pedantic commodity $ format $1,000.00 @@ -39,7 +37,7 @@ test reg 12-Feb-29 KFC Expenses:Food $25.00 $25.00 Assets:Cash $-25.00 0 __ERROR__ -Warning: "$FILE", line 26: Transaction check failed: (abs(amount) <= {20}) -Warning: "$FILE", line 30: Transaction check failed: (abs(amount) <= {20}) +Warning: "$FILE", line 24: Transaction check failed: (abs(amount) <= {20}) +Warning: "$FILE", line 28: Transaction check failed: (abs(amount) <= {20}) end test diff --git a/test/baseline/dir-alias-fail.test b/test/baseline/dir-alias-fail.test new file mode 100644 index 00000000..444f083b --- /dev/null +++ b/test/baseline/dir-alias-fail.test @@ -0,0 +1,10 @@ +alias Foo=Foo + +2011-01-01 Test + Foo 10 EUR + Bar +test source -> 1 +__ERROR__ +While parsing file "$FILE", line 1: +Error: Illegal alias Foo=Foo +end test diff --git a/test/baseline/dir-alias.test b/test/baseline/dir-alias.test new file mode 100644 index 00000000..103868d8 --- /dev/null +++ b/test/baseline/dir-alias.test @@ -0,0 +1,22 @@ +alias A=B:A +alias B=C:B +alias C=D:C + +account Delta + alias D + +2001-01-01 Test + A 10 EUR + Foo + +2001-01-01 Test + D 20 EUR + Foo + +test reg +01-Jan-01 Test B:A 10 EUR 10 EUR + Foo -10 EUR 0 +01-Jan-01 Test Delta 20 EUR 20 EUR + Foo -20 EUR 0 +end test + diff --git a/test/baseline/dir-commodity.test b/test/baseline/dir-commodity.test index fc925648..935efdf1 100644 --- a/test/baseline/dir-commodity.test +++ b/test/baseline/dir-commodity.test @@ -12,7 +12,7 @@ commodity GBP test bal --pedantic -> 1 __ERROR__ -While parsing file "$FILE", line 10: +While parsing file "$FILE", line 10: While parsing posting: A 20.00 EUR ^^^^^^^^^ diff --git a/test/baseline/dir-payee.test b/test/baseline/dir-payee.test index b81bbc2b..e5c7e5a1 100644 --- a/test/baseline/dir-payee.test +++ b/test/baseline/dir-payee.test @@ -1,12 +1,22 @@ payee KFC alias Kentucky Fried Chicken +payee Foo Bar Inc + uuid 2a2e21d434356f886c84371eebac6e44f1337fda + 2012-03-25 * Kentucky Fried Chicken A 10 B +2014-05-13 * UNHELPFUL PAYEE ; will be read as being 'Foo Bar Inc' + ; UUID: 2a2e21d434356f886c84371eebac6e44f1337fda + A 20 + B + test reg 12-Mar-25 KFC A 10 10 B -10 0 +14-May-13 Foo Bar Inc A 20 20 + B -20 0 end test diff --git a/test/baseline/feat-balance_assert-off.test b/test/baseline/feat-balance_assert-off.test new file mode 100644 index 00000000..fed24d4a --- /dev/null +++ b/test/baseline/feat-balance_assert-off.test @@ -0,0 +1,18 @@ + +2014-05-01 * Opening balance + Assets:Cash $100 + Equity:Opening balance + +2014-05-10 * Spend money + Expenses:Foo $10 + Assets:Cash -$10 = $80 + +test bal -> 1 +__ERROR__ +While parsing file "$FILE", line 8: +While parsing posting: + Assets:Cash -$10 = $80 + ^^^ +Error: Balance assertion off by $-10 (expected to see $100) +end test + diff --git a/test/baseline/feat-balance_assert_split.test b/test/baseline/feat-balance_assert_split.test new file mode 100644 index 00000000..2d9cce9f --- /dev/null +++ b/test/baseline/feat-balance_assert_split.test @@ -0,0 +1,60 @@ +;; a.dat + +2012-01-01 Test + Expenses:Unknown $100.00 + Liabilities:MasterCard + +2012-01-02 Test + Expenses:Unknown $100.00 + Liabilities:MasterCard + +2012-01-03 Test + Expenses:Unknown $100.00 + Liabilities:MasterCard + +2012-01-04 Test + ; UUID: foo + Liabilities:MasterCard $150.00 = $-300 + <Assets:Checking> + +2012-01-04 Test + ; UUID: bar + Liabilities:MasterCard $150.00 = $0 + <Assets:Checking> + +2012-01-04 Test + ; UUID: baz + Liabilities:MasterCard $150.00 = $0 + <Assets:Checking> + +;; b.dat + +2012-01-01 Test + Assets:Checking $150.00 + Income + +2012-01-02 Test + Assets:Checking $150.00 + Income + +2012-01-03 Test + Assets:Checking $150.00 + Income + +2012-01-04 Test + ; UUID: foo + Liabilities:MasterCard $150.00 + Assets:Checking $-150.00 = $300.00 + +2012-01-04 Test + ; UUID: bar + Liabilities:MasterCard $150.00 + Assets:Checking $-150.00 = $150.00 + +test balance + $300.00 Expenses:Unknown + $-450.00 Income + $150.00 Liabilities:MasterCard +-------------------- + 0 +end test diff --git a/test/baseline/feat-convert-with-diretives.dat b/test/baseline/feat-convert-with-directives.dat index ac13ff81..ac13ff81 100644 --- a/test/baseline/feat-convert-with-diretives.dat +++ b/test/baseline/feat-convert-with-directives.dat diff --git a/test/baseline/feat-convert-with-diretives.test b/test/baseline/feat-convert-with-directives.test index 2f6e0102..53adb7a6 100644 --- a/test/baseline/feat-convert-with-diretives.test +++ b/test/baseline/feat-convert-with-directives.test @@ -6,7 +6,7 @@ payee REWE alias REWE SAGT DANKE # When reading csv file without directives: -test -f /dev/null convert test/baseline/feat-convert-with-diretives.dat +test -f /dev/null convert test/baseline/feat-convert-with-directives.dat 2012/01/01 * KFC Expenses:Unknown $10 Equity:Unknown @@ -17,7 +17,7 @@ test -f /dev/null convert test/baseline/feat-convert-with-diretives.dat end test # When reading csv file with directives: -test --account "Assets:Cash" convert test/baseline/feat-convert-with-diretives.dat +test --account "Assets:Cash" convert test/baseline/feat-convert-with-directives.dat 2012/01/01 * KFC Expenses:Food $10 Assets:Cash diff --git a/test/baseline/opt-base.test b/test/baseline/opt-base.test index 060dee42..a987c385 100644 --- a/test/baseline/opt-base.test +++ b/test/baseline/opt-base.test @@ -16,12 +16,11 @@ test bal --base 7200s A $8,000.00 Assets:Receivable 7200s B - $3,200.00 Equity:Capital Gains $-3,200.00 -288000s Income -288000s Contracts $-3,200.00 Gains -------------------- - $8,000.00 + $4,800.00 -273600s end test diff --git a/test/baseline/opt-date.test b/test/baseline/opt-date.test index e69de29b..9868e0ea 100644 --- a/test/baseline/opt-date.test +++ b/test/baseline/opt-date.test @@ -0,0 +1,50 @@ +D 1000.00 GBP + +2011-03-04 Buy shares ; date: 2011-04-05 + Assets:Broker 2 AAA @ 0.90 GBP + Assets:Bank + +2011-03-05 Buy shares ; date: 2011-04-06 + Assets:Broker 2 AAA @ 1.00 GBP + Assets:Bank + +test reg --input-date-format %Y-%m-%d --date-format %d-%m-%Y --date 'has_tag("date") ? to_date(tag("date")) : date' +05-04-2011 Buy shares Assets:Broker 2 AAA 2 AAA +05-04-2011 Buy shares Assets:Bank -1.80 GBP 2 AAA + -1.80 GBP +06-04-2011 Buy shares Assets:Broker 2 AAA 4 AAA + -1.80 GBP +06-04-2011 Buy shares Assets:Bank -2.00 GBP 4 AAA + -3.80 GBP +end test + +test reg --date 'date + 2' +11-Mar-06 Buy shares Assets:Broker 2 AAA 2 AAA +11-Mar-06 Buy shares Assets:Bank -1.80 GBP 2 AAA + -1.80 GBP +11-Mar-07 Buy shares Assets:Broker 2 AAA 4 AAA + -1.80 GBP +11-Mar-07 Buy shares Assets:Bank -2.00 GBP 4 AAA + -3.80 GBP +end test + +test reg --date 'date - 2' +11-Mar-02 Buy shares Assets:Broker 2 AAA 2 AAA +11-Mar-02 Buy shares Assets:Bank -1.80 GBP 2 AAA + -1.80 GBP +11-Mar-03 Buy shares Assets:Broker 2 AAA 4 AAA + -1.80 GBP +11-Mar-03 Buy shares Assets:Bank -2.00 GBP 4 AAA + -3.80 GBP +end test + +test reg --date 'date + 365*2' +13-Mar-03 Buy shares Assets:Broker 2 AAA 2 AAA +13-Mar-03 Buy shares Assets:Bank -1.80 GBP 2 AAA + -1.80 GBP +13-Mar-04 Buy shares Assets:Broker 2 AAA 4 AAA + -1.80 GBP +13-Mar-04 Buy shares Assets:Bank -2.00 GBP 4 AAA + -3.80 GBP +end test + diff --git a/test/baseline/opt-datetime-format.test b/test/baseline/opt-datetime-format.test index e69de29b..8550474e 100644 --- a/test/baseline/opt-datetime-format.test +++ b/test/baseline/opt-datetime-format.test @@ -0,0 +1,22 @@ +i 2013/04/05 09:30:00 Internal:Meeting:Tactical Intelligent comment +o 2013/04/05 10:00:00 +i 2013/04/05 10:00:00 CustomerA:Email +o 2013/04/05 10:05:00 +i 2013/04/05 10:05:00 CustomerB:Config +o 2013/04/05 11:30:00 +i 2013/04/05 11:30:00 Personal:Walk +o 2013/04/05 12:00:00 +i 2013/04/05 12:00:00 Personal:Lunch +o 2013/04/05 13:30:00 + +test bal --time-report --datetime-format '%m/%d/%y %I:%M %p' + 04/05/13 10:00 AM 04/05/13 10:05 AM 5.0m CustomerA:Email + 04/05/13 10:05 AM 04/05/13 11:30 AM 1.42h CustomerB:Config + 04/05/13 09:30 AM 04/05/13 10:00 AM 30.0m Internal:Meeting:Tactical + 2.00h Personal + 04/05/13 12:00 PM 04/05/13 01:30 PM 1.50h Lunch + 04/05/13 11:30 AM 04/05/13 12:00 PM 30.0m Walk +-------------------------------------------------- + +end test + diff --git a/test/baseline/opt-dc.test b/test/baseline/opt-dc.test index 24a564dd..5990c882 100644 --- a/test/baseline/opt-dc.test +++ b/test/baseline/opt-dc.test @@ -14,3 +14,25 @@ Expenses:Food $20 Expenses:Food $-5 Assets:Cash + +test reg --dc +12-Mar-10 Employer Assets:Cash $100 0 $100 + Incom:Employer 0 $100 0 +12-Mar-10 KFC Expenses:Food $20 0 $20 + Assets:Cash 0 $20 0 +12-Mar-10 KFC - Rebate Assets:Cash $5 0 $5 + Expenses:Food 0 $5 0 +12-Mar-10 KFC - Food & R.. Expenses:Food $20 0 $20 + Expenses:Food 0 $5 $15 + Assets:Cash 0 $15 0 +end test + +test bal --dc + $105 $35 $70 Assets:Cash + $40 $10 $30 Expenses:Food + 0 $100 $-100 Income:Employer +-------------------------------------------- + $145 $145 0 +end test + + diff --git a/test/baseline/opt-equity.test b/test/baseline/opt-equity.test index 35ea6b1e..80503e09 100644 --- a/test/baseline/opt-equity.test +++ b/test/baseline/opt-equity.test @@ -8,51 +8,42 @@ D 1000.00 GBP Assets:Broker 2 AAA @ 1.00 GBP Assets:Bank -test equity -2011/03/05 Opening Balances - Assets:Bank -3.80 GBP - Assets:Broker 4 AAA - Equity:Opening Balances -4 AAA - Equity:Opening Balances 3.80 GBP +test reg --equity +11-Mar-05 Opening Balances Assets:Bank -3.80 GBP -3.80 GBP + Assets:Broker 4 AAA 4 AAA + -3.80 GBP + Equit:Opening Balances -4 AAA -3.80 GBP + Equit:Opening Balances 3.80 GBP 0 end test -test equity assets -2011/03/05 Opening Balances - Assets:Bank -3.80 GBP - Assets:Broker 4 AAA - Equity:Opening Balances -4 AAA - Equity:Opening Balances 3.80 GBP +test reg assets --equity +11-Mar-05 Opening Balances Assets:Bank -3.80 GBP -3.80 GBP + Assets:Broker 4 AAA 4 AAA + -3.80 GBP + Equit:Opening Balances -4 AAA -3.80 GBP + Equit:Opening Balances 3.80 GBP 0 end test -test equity assets:bank -2011/03/05 Opening Balances - Assets:Bank -3.80 GBP - Equity:Opening Balances +test reg assets:bank --equity +11-Mar-05 Opening Balances Assets:Bank -3.80 GBP -3.80 GBP + Equit:Opening Balances 3.80 GBP 0 end test -test equity assets:broker -2011/03/05 Opening Balances - Assets:Broker 4 AAA - Equity:Opening Balances +test reg assets:broker --equity +11-Mar-05 Opening Balances Assets:Broker 4 AAA 4 AAA + Equit:Opening Balances -4 AAA 0 end test -test equity --lot-prices -2011/03/05 Opening Balances - Assets:Bank -3.80 GBP - Assets:Broker 2 AAA {0.90 GBP} - Assets:Broker 2 AAA {1.00 GBP} - Equity:Opening Balances -2 AAA {0.90 GBP} - Equity:Opening Balances -2 AAA {1.00 GBP} - Equity:Opening Balances 3.80 GBP -end test - -test equity --lots -2011/03/05 Opening Balances - Assets:Bank -3.80 GBP - Assets:Broker 2 AAA {0.90 GBP} [2011/03/04] - Assets:Broker 2 AAA {1.00 GBP} [2011/03/05] - Equity:Opening Balances -2 AAA {0.90 GBP} [2011/03/04] - Equity:Opening Balances -2 AAA {1.00 GBP} [2011/03/05] - Equity:Opening Balances 3.80 GBP +test reg --lots --date-format %Y/%m/%d --equity +2011/03/05 Opening Balances Assets:Bank -3.80 GBP -3.80 GBP + Assets:Broker 2 AAA {0.90 GBP} [2011/03/04] 2 AAA {0.90 GBP} [2011/03/04] + -3.80 GBP + Assets:Broker 2 AAA {1.00 GBP} [2011/03/05] 2 AAA {0.90 GBP} [2011/03/04] + 2 AAA {1.00 GBP} [2011/03/05] + -3.80 GBP + Equit:Opening Balances -2 AAA {0.90 GBP} [2011/03/04] 2 AAA {1.00 GBP} [2011/03/05] + -3.80 GBP + Equit:Opening Balances -2 AAA {1.00 GBP} [2011/03/05] -3.80 GBP + Equit:Opening Balances 3.80 GBP 0 end test diff --git a/test/baseline/opt-gain.test b/test/baseline/opt-gain.test index 4370a22e..8188976c 100644 --- a/test/baseline/opt-gain.test +++ b/test/baseline/opt-gain.test @@ -26,7 +26,7 @@ P 2009/04/01 00:00:00 S 16 P ; 2010/01/01 Sample 1b ; Assets:Brokerage:Cash -100 P ; Assets:Brokerage:Stocks 100 S -; +; ; P 2010/01/01 00:00:00 S 2 P 2010/02/01 Sample 2b @@ -62,3 +62,12 @@ test reg --gain stocks 10-Apr-01 Commodities revalued <Revalued> 3200 P 6000 P 10-Apr-01 Sample 4b Asset:Brokerage:Stocks -1500 P 4500 P end test + +test bal --change + 4500 P Assets:Brokerage:Stocks +end test + +test bal -G + 4500 P Assets:Brokerage:Stocks +end test + diff --git a/test/baseline/opt-head.test b/test/baseline/opt-head.test index d0f0368c..f5addf5f 100644 --- a/test/baseline/opt-head.test +++ b/test/baseline/opt-head.test @@ -202,3 +202,17 @@ test reg --head=10 books 08-May-01 May Expenses:Books $50.00 $250.00 08-May-31 End of May Expenses:Books $50.00 $300.00 end test + +test reg --first=10 books +08-Jan-01 January Expenses:Books $10.00 $10.00 +08-Jan-31 End of January Expenses:Books $10.00 $20.00 +08-Feb-01 February Expenses:Books $20.00 $40.00 +08-Feb-28 End of February Expenses:Books $20.00 $60.00 +08-Mar-01 March Expenses:Books $30.00 $90.00 +08-Mar-31 End of March Expenses:Books $30.00 $120.00 +08-Apr-01 April Expenses:Books $40.00 $160.00 +08-Apr-30 End of April Expenses:Books $40.00 $200.00 +08-May-01 May Expenses:Books $50.00 $250.00 +08-May-31 End of May Expenses:Books $50.00 $300.00 +end test + diff --git a/test/baseline/opt-historical.test b/test/baseline/opt-historical.test index 820f5ff0..a882d91a 100644 --- a/test/baseline/opt-historical.test +++ b/test/baseline/opt-historical.test @@ -50,11 +50,11 @@ test reg stocks -O end test test reg stocks -B -12-Jan-01 Broker Assets:Stocks $100 $100 -12-Feb-02 Broker Assets:Stocks $200 $300 -12-Mar-03 Broker Assets:Stocks $300 $600 -12-Apr-04 Broker Assets:Stocks $400 $1000 -12-May-05 Broker Assets:Stocks $500 $1500 +12-Jan-01 Broker Assets:Stocks $10 $10 +12-Feb-02 Broker Assets:Stocks $20 $30 +12-Mar-03 Broker Assets:Stocks $30 $60 +12-Apr-04 Broker Assets:Stocks $40 $100 +12-May-05 Broker Assets:Stocks $50 $150 end test test reg stocks -I @@ -98,11 +98,11 @@ test reg stocks -O -V --now=2012/05/10 end test test reg stocks -B -V -12-Jan-01 Broker Assets:Stocks $100 $100 -12-Feb-02 Broker Assets:Stocks $200 $300 -12-Mar-03 Broker Assets:Stocks $300 $600 -12-Apr-04 Broker Assets:Stocks $400 $1000 -12-May-05 Broker Assets:Stocks $500 $1500 +12-Jan-01 Broker Assets:Stocks $10 $10 +12-Feb-02 Broker Assets:Stocks $20 $30 +12-Mar-03 Broker Assets:Stocks $30 $60 +12-Apr-04 Broker Assets:Stocks $40 $100 +12-May-05 Broker Assets:Stocks $50 $150 end test test reg stocks -I -V @@ -138,11 +138,11 @@ test reg stocks -O -X EUR --now=2012/05/10 end test test reg stocks -B -X EUR -12-Jan-01 Broker Assets:Stocks EUR 200,00 EUR 200,00 -12-Feb-02 Broker Assets:Stocks EUR 400,00 EUR 600,00 -12-Mar-03 Broker Assets:Stocks EUR 600,00 EUR 1.200,00 -12-Apr-04 Broker Assets:Stocks EUR 800,00 EUR 2.000,00 -12-May-05 Broker Assets:Stocks EUR 1.000,00 EUR 3.000,00 +12-Jan-01 Broker Assets:Stocks EUR 20,00 EUR 20,00 +12-Feb-02 Broker Assets:Stocks EUR 40,00 EUR 60,00 +12-Mar-03 Broker Assets:Stocks EUR 60,00 EUR 120,00 +12-Apr-04 Broker Assets:Stocks EUR 80,00 EUR 200,00 +12-May-05 Broker Assets:Stocks EUR 100,00 EUR 300,00 end test test reg stocks -I -X EUR @@ -170,11 +170,11 @@ test reg stocks -O -H end test test reg stocks -B -H -12-Jan-01 Broker Assets:Stocks $100 $100 -12-Feb-02 Broker Assets:Stocks $200 $300 -12-Mar-03 Broker Assets:Stocks $300 $600 -12-Apr-04 Broker Assets:Stocks $400 $1000 -12-May-05 Broker Assets:Stocks $500 $1500 +12-Jan-01 Broker Assets:Stocks $10 $10 +12-Feb-02 Broker Assets:Stocks $20 $30 +12-Mar-03 Broker Assets:Stocks $30 $60 +12-Apr-04 Broker Assets:Stocks $40 $100 +12-May-05 Broker Assets:Stocks $50 $150 end test test reg stocks -I -H @@ -202,11 +202,11 @@ test reg stocks -O -H -V end test test reg stocks -B -H -V -12-Jan-01 Broker Assets:Stocks $100 $100 -12-Feb-02 Broker Assets:Stocks $200 $300 -12-Mar-03 Broker Assets:Stocks $300 $600 -12-Apr-04 Broker Assets:Stocks $400 $1000 -12-May-05 Broker Assets:Stocks $500 $1500 +12-Jan-01 Broker Assets:Stocks $10 $10 +12-Feb-02 Broker Assets:Stocks $20 $30 +12-Mar-03 Broker Assets:Stocks $30 $60 +12-Apr-04 Broker Assets:Stocks $40 $100 +12-May-05 Broker Assets:Stocks $50 $150 end test test reg stocks -I -H -V @@ -234,11 +234,11 @@ test reg stocks -O -H -X EUR end test test reg stocks -B -H -X EUR -12-Jan-01 Broker Assets:Stocks EUR 200,00 EUR 200,00 -12-Feb-02 Broker Assets:Stocks EUR 400,00 EUR 600,00 -12-Mar-03 Broker Assets:Stocks EUR 600,00 EUR 1.200,00 -12-Apr-04 Broker Assets:Stocks EUR 800,00 EUR 2.000,00 -12-May-05 Broker Assets:Stocks EUR 1.000,00 EUR 3.000,00 +12-Jan-01 Broker Assets:Stocks EUR 20,00 EUR 20,00 +12-Feb-02 Broker Assets:Stocks EUR 40,00 EUR 60,00 +12-Mar-03 Broker Assets:Stocks EUR 60,00 EUR 120,00 +12-Apr-04 Broker Assets:Stocks EUR 80,00 EUR 200,00 +12-May-05 Broker Assets:Stocks EUR 100,00 EUR 300,00 end test test reg stocks -I -H -X EUR diff --git a/test/baseline/opt-immediate.test b/test/baseline/opt-immediate.test index e69de29b..fce6d220 100644 --- a/test/baseline/opt-immediate.test +++ b/test/baseline/opt-immediate.test @@ -0,0 +1,32 @@ +D 1000.00 EUR + +2012-01-01 * Test + Assets:Investments 1 AAA @@ 10.00 EUR + Assets:Investments 1 BBB @@ 20.00 EUR + Equity:Opening balance + +P 2012-07-01 AAA 10.123 EUR +P 2012-07-01 BBB 20.123 EUR + +test bal -V --unrealized + 30.25 EUR Assets:Investments + -30.25 EUR Equity + -30.00 EUR Opening balance + -0.25 EUR Unrealized Gains +-------------------- + 0 +end test + +test bal -V --immediate + 30.00 EUR Assets:Investments + -30.00 EUR Equity:Opening balance +-------------------- + 0 +end test + +test reg -V --immediate +12-Jan-01 Test Assets:Investments 10.00 EUR 10.00 EUR + Assets:Investments 20.00 EUR 30.00 EUR + Equity:Opening balance -30.00 EUR 0 +end test + diff --git a/test/baseline/opt-lot-dates.test b/test/baseline/opt-lot-dates.test index c07e96e8..cf3fad34 100644 --- a/test/baseline/opt-lot-dates.test +++ b/test/baseline/opt-lot-dates.test @@ -549,7 +549,7 @@ D 1.00G Assets:Tajer:Items "Orb of Deception" 1 @ 155G Assets:Tajer -test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates +test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates --date-format %Y/%m/%d 133.98G 158.85G 0 @@ -840,27 +840,21 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] @@ -868,7 +862,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] @@ -876,7 +870,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] @@ -884,213 +878,213 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 1 "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 50.42G + -4.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 59.83G + 5.25G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.43G + -8.14G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.66G + -7.92G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.78G + -7.80G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.90G + -7.68G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.91G + -7.67G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.92G + -7.66G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.82G + -7.75G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 47.22G + -7.36G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.43G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 51.43G + -3.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.42G + 11.85G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 45.42G + -9.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 45.52G + -9.06G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 45.42G + -9.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 45.42G + -9.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 75.42G + 20.85G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 45.42G + -9.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1098,7 +1092,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 45.42G + -9.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1106,7 +1100,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.42G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1115,15 +1109,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.42G - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 15.42G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1131,7 +1117,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.43G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1139,7 +1125,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.42G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1147,7 +1133,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.43G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1155,7 +1141,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.42G + -39.14G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1163,7 +1149,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.63G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1171,7 +1157,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.42G + -38.94G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1179,7 +1165,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 16.17G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1187,7 +1173,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 16.92G + -38.40G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1195,7 +1181,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.42G + -37.65G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1203,7 +1189,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.42G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1211,7 +1197,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.42G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1219,7 +1205,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.43G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1227,7 +1213,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.42G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1235,7 +1221,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.43G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1243,7 +1229,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.42G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1251,7 +1237,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.43G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1259,7 +1245,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.42G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1267,7 +1253,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 16.42G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1275,7 +1261,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 15.42G + -38.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1283,7 +1269,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 33.48G + -39.15G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1291,16 +1277,15 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 33.48G + -21.10G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -1 "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 16.92G + -21.10G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1309,7 +1294,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 33.48G + -37.65G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1318,7 +1303,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 51.54G + -19.60G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1327,7 +1312,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 51.54G + -19.60G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1336,7 +1321,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 34.48G + -36.65G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1345,7 +1330,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 51.54G + -36.65G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1354,7 +1339,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 51.54G + -36.65G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1363,27 +1348,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 51.54G - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 51.54G - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" 2 [2006/03/16] - "Ace of Warlords" -2 [2006/03/17] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 51.54G + -36.65G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1394,7 +1359,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" -2 [2006/03/17] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 52.29G + -36.65G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1405,7 +1370,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" -2 [2006/03/17] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 51.54G + -35.91G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1416,7 +1381,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" -2 [2006/03/17] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 51.57G + -36.65G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1427,7 +1392,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" -2 [2006/03/17] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 51.54G + -36.62G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1438,7 +1403,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" -2 [2006/03/17] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 52.54G + -36.65G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] @@ -1449,9 +1414,8 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" -2 [2006/03/17] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 52.54G + -35.65G "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" -2 @@ -1461,7 +1425,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" -2 [2006/03/17] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 52.79G + -35.65G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" -1 "Plans: Wildthorn Mail" 1 [2006/03/14] @@ -1473,7 +1437,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" -2 [2006/03/17] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 52.54G + -35.40G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" -1 "Plans: Wildthorn Mail" 1 [2006/03/14] @@ -1485,7 +1449,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" -2 [2006/03/17] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 55.33G + -32.62G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" -1 "Plans: Wildthorn Mail" 1 [2006/03/14] @@ -1497,7 +1461,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" -2 [2006/03/17] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 52.54G + -35.40G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" -1 "Plans: Wildthorn Mail" 1 [2006/03/14] @@ -1509,30 +1473,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" -1 [2006/03/17] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 52.54G - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 52.54G - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 52.54G - "Holy Bologna" 1 [2006/03/17] + -35.40G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" -1 "Plans: Wildthorn Mail" 1 [2006/03/14] @@ -1543,20 +1484,18 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 52.54G - "Holy Bologna" 1 [2006/03/17] + -35.40G "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" -1 "Plans: Wildthorn Mail" 1 [2006/03/14] "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" -2 "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Emerald Dream" 1 [2006/03/17] "Wildheart Belt" 1 [2006/03/17] "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 52.54G + -35.40G "Holy Bologna" 1 [2006/03/17] "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" -1 @@ -1564,14 +1503,11 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" -2 "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" 1 [2006/03/17] "Wildheart Belt" 1 [2006/03/17] "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 52.54G - "Harnessing Shadows" 1 [2006/03/17] + -35.40G "Holy Bologna" 1 [2006/03/17] "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" -1 @@ -1579,15 +1515,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" -2 "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" 1 [2006/03/17] "The Emerald Dream" 1 [2006/03/17] "Wildheart Belt" 1 [2006/03/17] "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 52.54G - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" 1 [2006/03/17] + -35.40G "Holy Bologna" 1 [2006/03/17] "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" -1 @@ -1601,14 +1534,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 52.54G - "Garona: Book on Treachery" 1 [2006/03/17] + -35.40G "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" -1 "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" 5 [2006/03/17] "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" -2 "Recipe: Elixir of Giant Growth" 2 [2006/03/15] @@ -1618,14 +1549,13 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 25.64G + -35.40G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] "Plans: Mithril Shield Spike" 2 [2006/03/15] "Plans: Wildthorn Mail" -1 "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" 5 [2006/03/17] "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" -2 "Recipe: Elixir of Giant Growth" 2 [2006/03/15] @@ -1635,7 +1565,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 29.64G + -35.40G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1652,7 +1582,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 29.64G + -62.31G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1660,7 +1590,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Plans: Wildthorn Mail" -1 "Plans: Wildthorn Mail" 1 [2006/03/14] "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" -2 "Recipe: Elixir of Giant Growth" 2 [2006/03/15] @@ -1670,7 +1599,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 26.64G + -58.31G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1678,7 +1607,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Plans: Wildthorn Mail" -1 "Plans: Wildthorn Mail" 1 [2006/03/14] "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" -2 "Recipe: Elixir of Giant Growth" 2 [2006/03/15] @@ -1688,7 +1616,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 29.64G + -58.31G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1706,7 +1634,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 29.96G + -61.31G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1721,11 +1649,10 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "The Arcanist's Cookbook" 1 [2006/03/17] "The Emerald Dream" 1 [2006/03/17] "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -1 "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 29.96G + -60.99G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1744,7 +1671,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 32.64G + -60.99G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1763,7 +1690,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 29.96G + -58.31G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1782,7 +1709,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 31.21G + -57.05G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1801,7 +1728,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 29.96G + -58.31G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1820,7 +1747,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 44.96G + -43.31G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1839,7 +1766,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 44.96G + -43.30G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1858,7 +1785,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 29.96G + -58.31G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1877,7 +1804,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.20G + -22.06G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1896,7 +1823,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.20G + -22.06G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1916,27 +1843,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.20G - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" 1 [2006/03/17] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" 1 [2006/03/17] - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -1 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 34.36G + -22.06G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1956,7 +1863,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 50.38G + -53.90G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1976,7 +1883,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.20G + -3.94G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -1996,7 +1903,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 116.16G + -2.94G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2016,7 +1923,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 117.16G + -2.94G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2036,7 +1943,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 117.16G + -53.90G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2056,7 +1963,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.20G + -53.89G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2076,7 +1983,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.21G + -53.87G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2096,7 +2003,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.23G + -53.90G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2116,7 +2023,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.20G + -7.98G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2136,7 +2043,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 112.12G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2152,11 +2058,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "The Arcanist's Cookbook" 1 [2006/03/17] "The Emerald Dream" 1 [2006/03/17] "Wildheart Belt" 1 [2006/03/17] + 12.34s "Ace of Warlords" -1 "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 120.22G + -53.90G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2176,7 +2083,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.20G + 12.35G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2196,7 +2103,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 132.45G + 12.35G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2216,7 +2123,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 132.45G + -53.90G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2236,7 +2143,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.20G + -53.15G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2256,7 +2163,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.95G + -53.15G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2276,7 +2183,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.95G + -53.90G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2296,127 +2203,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 66.20G - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" 1 [2006/03/17] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" 1 [2006/03/17] - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -1 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 81.20G - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" 1 [2006/03/17] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" 1 [2006/03/17] - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -2 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 81.20G - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" 1 [2006/03/17] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" 1 [2006/03/17] - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -2 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 70.10G - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" 1 [2006/03/17] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" 1 [2006/03/17] - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -2 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 81.20G - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" 1 [2006/03/17] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" 1 [2006/03/17] - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -2 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 124.65G - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" 1 [2006/03/17] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" 1 [2006/03/17] - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -2 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 124.65G + -38.90G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2431,13 +2218,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "The Arcanist's Cookbook" 1 [2006/03/17] "The Emerald Dream" 1 [2006/03/17] - "Wildheart Belt" -1 "Wildheart Belt" 1 [2006/03/17] "Ace of Warlords" -2 "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 111.20G + -38.90G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2452,13 +2238,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "The Arcanist's Cookbook" 1 [2006/03/17] "The Emerald Dream" 1 [2006/03/17] - "Wildheart Belt" -1 "Wildheart Belt" 1 [2006/03/17] "Ace of Warlords" -2 "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 124.65G + -50.00G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2473,13 +2258,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "The Arcanist's Cookbook" 1 [2006/03/17] "The Emerald Dream" 1 [2006/03/17] - "Wildheart Belt" -1 "Wildheart Belt" 1 [2006/03/17] "Ace of Warlords" -2 "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 144.60G + -6.55G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] @@ -2494,15 +2278,13 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "The Arcanist's Cookbook" 1 [2006/03/17] "The Emerald Dream" 1 [2006/03/17] - "Wildheart Belt" -1 "Wildheart Belt" 1 [2006/03/17] "Ace of Warlords" -2 "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 144.60G + -6.55G "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" -1 "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] "Plans: Mithril Shield Spike" -2 @@ -2522,9 +2304,8 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 129.65G + -20.00G "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" -1 "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] "Plans: Mithril Shield Spike" -2 @@ -2544,9 +2325,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 144.60G "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" -1 "Harnessing Shadows" 1 [2006/03/17] "Holy Bologna" 1 [2006/03/17] "Plans: Mithril Shield Spike" -2 @@ -2562,11 +2341,11 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "The Emerald Dream" 1 [2006/03/17] "Wildheart Belt" -1 "Wildheart Belt" 1 [2006/03/17] + -5.00s "Ace of Warlords" -2 "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 173.10G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 "Harnessing Shadows" 1 [2006/03/17] @@ -2584,12 +2363,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "The Emerald Dream" 1 [2006/03/17] "Wildheart Belt" -1 "Wildheart Belt" 1 [2006/03/17] + -5.00s "Ace of Warlords" -2 "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 173.10G - "Garona: Book on Treachery" -1 + -15.00G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 "Harnessing Shadows" 1 [2006/03/17] @@ -2611,8 +2390,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 148.60G - "Garona: Book on Treachery" -1 + 13.50G "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 "Harnessing Shadows" 1 [2006/03/17] @@ -2634,7 +2412,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 173.10G + 13.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -2657,7 +2435,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 190.20G + -11.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -2680,7 +2458,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 190.20G + 6.10G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -2695,7 +2473,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Pulsating Hydra Heart" 1 [2006/03/16] "Recipe: Elixir of Giant Growth" -2 "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" -1 "The Arcanist's Cookbook" 1 [2006/03/17] "The Emerald Dream" 1 [2006/03/17] "Wildheart Belt" -1 @@ -2704,7 +2481,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 177.10G + 6.10G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -2728,7 +2505,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 190.20G + -7.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -2752,7 +2529,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 194.85G + -2.35G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -2776,7 +2553,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 194.85G + -2.35G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -2801,7 +2578,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 191.20G + -6.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -2826,32 +2603,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 194.85G - "Garona: Book on Treachery" -1 - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" -1 - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" 1 [2006/03/17] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" -5 - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" -1 - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" 1 [2006/03/17] - "Wildheart Belt" -1 - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -2 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 194.85G + -6.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -2877,90 +2629,11 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 194.85G - "Garona: Book on Treachery" -1 - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" -1 - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" 1 [2006/03/17] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" -5 - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" -1 - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" 1 [2006/03/17] - "Two of Portals" 2 [2006/03/19] - "Wildheart Belt" -1 - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -2 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 189.35G - "Garona: Book on Treachery" -1 - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" -1 - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" 1 [2006/03/17] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" -5 - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" -1 - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" 1 [2006/03/17] - "Two of Portals" 2 [2006/03/19] - "Wildheart Belt" -1 - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -2 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 205.70G - "Garona: Book on Treachery" -1 - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" -1 - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" 1 [2006/03/17] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" -5 - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" -1 - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" 1 [2006/03/17] - "Two of Portals" 2 [2006/03/19] - "Wildheart Belt" -1 - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -2 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 205.70G + -6.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" -1 "Holy Bologna" 1 [2006/03/17] "Plans: Mithril Shield Spike" -2 "Plans: Mithril Shield Spike" 2 [2006/03/15] @@ -2982,12 +2655,11 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 191.35G + -11.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" -1 "Holy Bologna" 1 [2006/03/17] "Plans: Mithril Shield Spike" -2 "Plans: Mithril Shield Spike" 2 [2006/03/15] @@ -3009,12 +2681,11 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 205.70G + 4.84G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" -1 "Holy Bologna" 1 [2006/03/17] "Plans: Mithril Shield Spike" -2 "Plans: Mithril Shield Spike" 2 [2006/03/15] @@ -3036,7 +2707,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 210.70G + 4.84G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3063,7 +2734,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 210.70G + -9.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3083,7 +2754,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "The Arcanist's Cookbook" -1 "The Arcanist's Cookbook" 1 [2006/03/17] "The Emerald Dream" 1 [2006/03/17] - "Two of Portals" -1 "Two of Portals" 2 [2006/03/19] "Wildheart Belt" -1 "Wildheart Belt" 1 [2006/03/17] @@ -3091,7 +2761,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 208.70G + -4.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3111,7 +2781,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "The Arcanist's Cookbook" -1 "The Arcanist's Cookbook" 1 [2006/03/17] "The Emerald Dream" 1 [2006/03/17] - "Two of Portals" -1 "Two of Portals" 2 [2006/03/19] "Wildheart Belt" -1 "Wildheart Belt" 1 [2006/03/17] @@ -3119,7 +2788,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 210.70G + -4.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3147,7 +2816,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 225.70G + -6.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3175,7 +2844,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 225.70G + 8.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3194,7 +2863,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Recipe: Elixir of Giant Growth" 2 [2006/03/15] "The Arcanist's Cookbook" -1 "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" -1 "The Emerald Dream" 1 [2006/03/17] "Two of Portals" -1 "Two of Portals" 2 [2006/03/19] @@ -3204,7 +2872,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 214.70G + 8.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3233,7 +2901,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 225.70G + -2.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3262,7 +2930,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 225.70G + -2.49G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3291,7 +2959,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 225.70G + -2.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3320,7 +2988,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 225.70G + -2.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3350,7 +3018,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 55.70G + -172.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3380,7 +3048,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 55.97G + -172.22G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3410,7 +3078,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 56.25G + -171.95G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3440,7 +3108,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 55.70G + -172.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3470,7 +3138,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 55.70G + -172.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3501,7 +3169,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - -144.30G + -372.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3532,7 +3200,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - -142.53G + -370.73G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3563,7 +3231,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - -140.76G + -368.96G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3594,7 +3262,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - -138.99G + -367.19G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3625,7 +3293,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - -137.22G + -365.42G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3656,7 +3324,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - -136.47G + -364.67G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3687,7 +3355,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - -144.30G + -372.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3718,7 +3386,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 22.22G + -205.97G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3749,7 +3417,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 22.22G + -205.97G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3781,7 +3449,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 25.70G + -202.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3813,7 +3481,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 22.22G + -194.30G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3845,39 +3513,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 30.42G - "Garona: Book on Treachery" -1 - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" -1 - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" -1 - "Holy Bologna" 1 [2006/03/17] - Nightblade 1 [2006/03/22] - "Orb of Deception" -1 - "Orb of Deception" 1 [2006/03/21] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" -5 - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" -1 - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" -1 - "The Emerald Dream" 1 [2006/03/17] - "Two of Portals" -1 - "Two of Portals" 2 [2006/03/19] - "Wildheart Belt" -1 - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -2 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 30.42G + -194.30G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3909,7 +3545,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 24.72G + -200.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3941,7 +3577,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 30.42G + -198.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -3973,7 +3609,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 31.92G + -198.50G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4005,7 +3641,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 31.92G + -198.49G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4037,7 +3673,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 31.93G + -200.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4069,7 +3705,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 30.42G + -40.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4101,72 +3737,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 190.42G - "Garona: Book on Treachery" -1 - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" -1 - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" -1 - "Holy Bologna" 1 [2006/03/17] - Nightblade 1 [2006/03/22] - "Orb of Deception" -1 - "Orb of Deception" 1 [2006/03/21] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" -5 - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" -1 - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" -1 - "The Emerald Dream" 1 [2006/03/17] - "Two of Portals" -2 - "Two of Portals" 2 [2006/03/19] - "Wildheart Belt" -1 - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -2 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 190.42G - "Garona: Book on Treachery" -1 - "Garona: Book on Treachery" 1 [2006/03/17] - "Harnessing Shadows" -1 - "Harnessing Shadows" 1 [2006/03/17] - "Holy Bologna" -1 - "Holy Bologna" 1 [2006/03/17] - Nightblade -1 - Nightblade 1 [2006/03/22] - "Orb of Deception" -1 - "Orb of Deception" 1 [2006/03/21] - "Plans: Mithril Shield Spike" -2 - "Plans: Mithril Shield Spike" 2 [2006/03/15] - "Plans: Wildthorn Mail" -1 - "Plans: Wildthorn Mail" 1 [2006/03/14] - "Preserved Holly" -5 - "Preserved Holly" 5 [2006/03/17] - "Pulsating Hydra Heart" -1 - "Pulsating Hydra Heart" 1 [2006/03/16] - "Recipe: Elixir of Giant Growth" -2 - "Recipe: Elixir of Giant Growth" 2 [2006/03/15] - "The Arcanist's Cookbook" -1 - "The Arcanist's Cookbook" 1 [2006/03/17] - "The Emerald Dream" -1 - "The Emerald Dream" 1 [2006/03/17] - "Two of Portals" -2 - "Two of Portals" 2 [2006/03/19] - "Wildheart Belt" -1 - "Wildheart Belt" 1 [2006/03/17] - "Ace of Warlords" -2 - "Ace of Warlords" 2 [2006/03/16] - "Beaststalker's Belt" -1 - "Beaststalker's Belt" 1 [2006/03/15] - 230.42G + -40.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4199,7 +3770,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 190.42G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4232,7 +3802,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 190.42G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4261,11 +3830,11 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Two of Portals" 2 [2006/03/19] "Wildheart Belt" -1 "Wildheart Belt" 1 [2006/03/17] + 30c "Ace of Warlords" -2 "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 190.42G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4298,7 +3867,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 244.42G + 54.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4331,7 +3900,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 254.42G + 64.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4364,7 +3933,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 264.42G + 74.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4397,7 +3966,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 264.48G + 74.06G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4430,7 +3999,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 264.52G + 74.10G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4463,7 +4032,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 264.52G + 74.10G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4496,7 +4065,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 190.42G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4529,7 +4097,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 190.42G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 @@ -4563,7 +4130,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates "Ace of Warlords" 2 [2006/03/16] "Beaststalker's Belt" -1 "Beaststalker's Belt" 1 [2006/03/15] - 35.42G + -155.00G "Garona: Book on Treachery" -1 "Garona: Book on Treachery" 1 [2006/03/17] "Harnessing Shadows" -1 diff --git a/test/baseline/opt-lot-prices.test b/test/baseline/opt-lot-prices.test index b23d5c67..0eca7a43 100644 --- a/test/baseline/opt-lot-prices.test +++ b/test/baseline/opt-lot-prices.test @@ -853,247 +853,241 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G - "Plans: Mithril Shield Spike" 1 {2.105G} - "Plans: Mithril Shield Spike" 1 {2.30G} - "Plans: Wildthorn Mail" 1 {1.25G} - "Recipe: Elixir of Giant Growth" 1 {1.00G} - "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 {2.105G} "Plans: Mithril Shield Spike" 2 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 {2.105G} "Plans: Mithril Shield Spike" 2 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 2 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 2 {2.105G} "Plans: Mithril Shield Spike" 2 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 2 {1.00G} "Recipe: Elixir of Giant Growth" 2 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 2 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 2 {1.00G} "Recipe: Elixir of Giant Growth" 2 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 2 {1.00G} "Recipe: Elixir of Giant Growth" 2 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 2 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 50.42G + -4.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 59.83G + 5.25G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.43G + -8.14G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.66G + -7.92G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.78G + -7.80G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.90G + -7.68G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.91G + -7.67G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.92G + -7.66G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.82G + -7.75G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 47.22G + -7.36G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.43G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 51.43G + -3.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 66.42G + 11.85G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 45.42G + -9.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 45.52G + -9.06G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 45.42G + -9.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 45.42G + -9.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 75.42G + 20.85G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} - 45.42G + -9.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1101,7 +1095,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 45.42G + -9.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1109,7 +1103,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1117,7 +1111,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 4 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1125,7 +1119,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1133,7 +1127,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.43G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1141,7 +1135,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1149,7 +1143,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.43G + -39.14G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1157,7 +1151,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1165,7 +1159,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.63G + -38.94G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1173,7 +1167,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1181,7 +1175,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 16.17G + -38.40G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1189,7 +1183,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 16.92G + -37.65G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1197,7 +1191,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1205,7 +1199,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1213,7 +1207,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1221,7 +1215,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.43G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1229,7 +1223,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1237,7 +1231,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.43G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1245,7 +1239,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1253,7 +1247,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.43G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1261,7 +1255,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1269,7 +1263,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 16.42G + -38.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1277,7 +1271,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1285,7 +1279,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 33.48G + -21.10G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} @@ -1293,147 +1287,129 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Recipe: Elixir of Giant Growth" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} "Ace of Warlords" 2 {15.00G} - 33.48G - "Plans: Mithril Shield Spike" 1 {2.105G} - "Plans: Mithril Shield Spike" 1 {2.30G} - "Plans: Wildthorn Mail" 1 {1.25G} - "Pulsating Hydra Heart" 1 {1.00G} - "Recipe: Elixir of Giant Growth" 1 {1.00G} - "Ace of Warlords" 2 {15.00G} - 16.92G + -21.10G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Ace of Warlords" 2 {15.00G} - 33.48G + -37.65G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Ace of Warlords" 2 {15.00G} - 51.54G + -19.60G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} "Ace of Warlords" 2 {15.00G} - 51.54G + -19.60G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Ace of Warlords" 2 {15.00G} - 34.48G + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Ace of Warlords" 2 {15.00G} - 51.54G + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Ace of Warlords" 2 {15.00G} - 51.54G + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Ace of Warlords" 2 {15.00G} - 51.54G - "Plans: Mithril Shield Spike" 1 {2.105G} - "Plans: Mithril Shield Spike" 1 {2.30G} - "Plans: Wildthorn Mail" 1 {1.25G} - "Pulsating Hydra Heart" 1 {1.00G} - "Ace of Warlords" 2 {15.00G} - 51.54G + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} - 51.54G + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} - 52.29G + -35.91G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} - 51.54G + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} - 51.57G + -36.62G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} - 51.54G + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} - 52.54G + -35.65G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} - 52.54G - "Plans: Mithril Shield Spike" 1 {2.105G} - "Plans: Mithril Shield Spike" 1 {2.30G} - "Pulsating Hydra Heart" 1 {1.00G} - "Wildheart Belt" 1 {30.00G} - 52.79G + -35.65G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} - 52.54G + -35.40G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} - 55.33G + -32.62G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} - 52.54G + -35.40G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} - 52.54G + -35.40G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 52.54G + -35.40G "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Pulsating Hydra Heart" 1 {1.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 52.54G + -35.40G "Holy Bologna" 1 {2.00G} "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} @@ -1441,7 +1417,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 52.54G + -35.40G "Holy Bologna" 1 {2.00G} "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} @@ -1450,7 +1426,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 52.54G + -35.40G "Holy Bologna" 1 {2.00G} "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} @@ -1460,7 +1436,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 52.54G + -35.40G "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} "Plans: Mithril Shield Spike" 1 {2.105G} @@ -1471,7 +1447,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 52.54G + -35.40G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1483,7 +1459,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 52.54G + -35.40G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1496,7 +1472,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 25.64G + -62.31G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1509,7 +1485,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 29.64G + -58.31G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1522,7 +1498,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 29.64G + -58.31G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1534,7 +1510,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 26.64G + -61.31G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1546,7 +1522,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 29.64G + -60.99G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1556,9 +1532,8 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} - "Ace of Warlords" 1 {3.00G} "Ace of Warlords" 1 {3.90G} - 29.96G + -60.99G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1569,7 +1544,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 29.96G + -58.31G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1580,7 +1555,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 32.64G + -57.05G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1591,7 +1566,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 29.96G + -58.31G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1602,7 +1577,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 31.21G + -43.31G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1613,7 +1588,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 29.96G + -43.30G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1624,7 +1599,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 44.96G + -58.31G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1635,7 +1610,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 44.96G + -22.06G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1646,39 +1621,35 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 29.96G + -22.06G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} - "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} "Preserved Holly" 5 {20.00s} "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 66.20G + -22.06G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} - "Plans: Mithril Shield Spike" 1 {2.105G} - "Plans: Mithril Shield Spike" 1 {2.30G} "Preserved Holly" 5 {20.00s} "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 66.20G + -53.90G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} - "Plans: Mithril Shield Spike" 1 {2.30G} "Preserved Holly" 5 {20.00s} "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 66.20G + -3.94G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1687,7 +1658,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 34.36G + -2.94G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1696,7 +1667,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 50.38G + -2.94G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1705,7 +1676,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 66.20G + -53.90G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1714,7 +1685,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 116.16G + -53.89G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1723,7 +1694,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 117.16G + -53.87G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1732,7 +1703,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 117.16G + -53.90G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1741,7 +1712,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 66.20G + -7.98G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1750,7 +1721,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 66.21G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1758,8 +1728,9 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} + 12.34s "Ace of Warlords" 1 {3.90G} - 66.23G + -53.90G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1768,7 +1739,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 66.20G + 12.35G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1777,7 +1748,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 112.12G + 12.35G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1786,7 +1757,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 120.22G + -53.90G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1795,7 +1766,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 66.20G + -53.15G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1804,7 +1775,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 132.45G + -53.15G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1813,7 +1784,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 132.45G + -53.90G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1822,7 +1793,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} "Ace of Warlords" 1 {3.90G} - 66.20G + -38.90G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1830,8 +1801,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} - "Ace of Warlords" 1 {3.90G} - 66.95G + -38.90G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1839,8 +1809,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} - "Ace of Warlords" 1 {3.90G} - 66.95G + -50.00G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1848,8 +1817,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} - "Ace of Warlords" 1 {3.90G} - 66.20G + -6.55G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} @@ -1857,294 +1825,212 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} "Wildheart Belt" 1 {30.00G} - "Ace of Warlords" 1 {3.90G} - 81.20G + -6.55G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} "Preserved Holly" 5 {20.00s} "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - "Wildheart Belt" 1 {30.00G} - 81.20G + -20.00G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} "Preserved Holly" 5 {20.00s} "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - "Wildheart Belt" 1 {30.00G} - 70.10G "Garona: Book on Treachery" 1 {4.00G} "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} "Preserved Holly" 5 {20.00s} "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - "Wildheart Belt" 1 {30.00G} - 81.20G + -5.00s "Garona: Book on Treachery" 1 {4.00G} - "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} "Preserved Holly" 5 {20.00s} "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - "Wildheart Belt" 1 {30.00G} - 124.65G + -5.00s + -15.00G "Garona: Book on Treachery" 1 {4.00G} - "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} "Preserved Holly" 5 {20.00s} "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - "Wildheart Belt" 1 {30.00G} - 124.65G + 13.50G "Garona: Book on Treachery" 1 {4.00G} - "Harnessing Shadows" 1 {5.00G} "Holy Bologna" 1 {2.00G} "Preserved Holly" 5 {20.00s} "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - 111.20G - "Garona: Book on Treachery" 1 {4.00G} - "Harnessing Shadows" 1 {5.00G} + 13.50G "Holy Bologna" 1 {2.00G} "Preserved Holly" 5 {20.00s} "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - 124.65G - "Garona: Book on Treachery" 1 {4.00G} - "Harnessing Shadows" 1 {5.00G} + -11.00G "Holy Bologna" 1 {2.00G} "Preserved Holly" 5 {20.00s} "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - 144.60G - "Garona: Book on Treachery" 1 {4.00G} - "Harnessing Shadows" 1 {5.00G} + 6.10G "Holy Bologna" 1 {2.00G} "Preserved Holly" 5 {20.00s} "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - 144.60G - "Garona: Book on Treachery" 1 {4.00G} + 6.10G "Holy Bologna" 1 {2.00G} "Preserved Holly" 5 {20.00s} - "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - 129.65G - "Garona: Book on Treachery" 1 {4.00G} + -7.00G "Holy Bologna" 1 {2.00G} "Preserved Holly" 5 {20.00s} - "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - 144.60G - "Garona: Book on Treachery" 1 {4.00G} + -2.35G "Holy Bologna" 1 {2.00G} "Preserved Holly" 5 {20.00s} - "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - 173.10G - "Garona: Book on Treachery" 1 {4.00G} + -2.35G "Holy Bologna" 1 {2.00G} - "Preserved Holly" 5 {20.00s} - "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - 173.10G + -6.00G "Holy Bologna" 1 {2.00G} - "Preserved Holly" 5 {20.00s} - "The Arcanist's Cookbook" 1 {4.00G} "The Emerald Dream" 1 {4.00G} - 148.60G - "Holy Bologna" 1 {2.00G} - "Preserved Holly" 5 {20.00s} - "The Arcanist's Cookbook" 1 {4.00G} - "The Emerald Dream" 1 {4.00G} - 173.10G - "Holy Bologna" 1 {2.00G} - "Preserved Holly" 5 {20.00s} - "The Arcanist's Cookbook" 1 {4.00G} - "The Emerald Dream" 1 {4.00G} - 190.20G - "Holy Bologna" 1 {2.00G} - "Preserved Holly" 5 {20.00s} - "The Arcanist's Cookbook" 1 {4.00G} - "The Emerald Dream" 1 {4.00G} - 190.20G - "Holy Bologna" 1 {2.00G} - "Preserved Holly" 5 {20.00s} - "The Emerald Dream" 1 {4.00G} - 177.10G - "Holy Bologna" 1 {2.00G} - "Preserved Holly" 5 {20.00s} - "The Emerald Dream" 1 {4.00G} - 190.20G - "Holy Bologna" 1 {2.00G} - "Preserved Holly" 5 {20.00s} - "The Emerald Dream" 1 {4.00G} - 194.85G - "Holy Bologna" 1 {2.00G} - "Preserved Holly" 5 {20.00s} - "The Emerald Dream" 1 {4.00G} - 194.85G - "Holy Bologna" 1 {2.00G} - "The Emerald Dream" 1 {4.00G} - 191.20G - "Holy Bologna" 1 {2.00G} - "The Emerald Dream" 1 {4.00G} - 194.85G - "Holy Bologna" 1 {2.00G} - "The Emerald Dream" 1 {4.00G} - 194.85G + -6.00G "Holy Bologna" 1 {2.00G} "The Emerald Dream" 1 {4.00G} "Two of Portals" 1 {3.00G} - 194.85G + -6.00G "Holy Bologna" 1 {2.00G} "The Emerald Dream" 1 {4.00G} "Two of Portals" 1 {2.50G} "Two of Portals" 1 {3.00G} - 189.35G + -11.50G "Holy Bologna" 1 {2.00G} "The Emerald Dream" 1 {4.00G} "Two of Portals" 1 {2.50G} "Two of Portals" 1 {3.00G} - 205.70G + 4.84G "Holy Bologna" 1 {2.00G} "The Emerald Dream" 1 {4.00G} "Two of Portals" 1 {2.50G} "Two of Portals" 1 {3.00G} - 205.70G + 4.84G "The Emerald Dream" 1 {4.00G} "Two of Portals" 1 {2.50G} "Two of Portals" 1 {3.00G} - 191.35G + -9.50G "The Emerald Dream" 1 {4.00G} "Two of Portals" 1 {2.50G} "Two of Portals" 1 {3.00G} - 205.70G + -4.50G "The Emerald Dream" 1 {4.00G} "Two of Portals" 1 {2.50G} "Two of Portals" 1 {3.00G} - 210.70G - "The Emerald Dream" 1 {4.00G} - "Two of Portals" 1 {2.50G} - "Two of Portals" 1 {3.00G} - 210.70G - "The Emerald Dream" 1 {4.00G} - "Two of Portals" 1 {2.50G} - 208.70G + -4.50G "The Emerald Dream" 1 {4.00G} "Two of Portals" 1 {2.50G} - 210.70G + -6.50G "The Emerald Dream" 1 {4.00G} "Two of Portals" 1 {2.50G} - 225.70G + 8.50G "The Emerald Dream" 1 {4.00G} "Two of Portals" 1 {2.50G} - 225.70G + 8.50G "Two of Portals" 1 {2.50G} - 214.70G + -2.50G "Two of Portals" 1 {2.50G} - 225.70G + -2.49G "Two of Portals" 1 {2.50G} - 225.70G + -2.50G "Two of Portals" 1 {2.50G} - 225.70G - "Two of Portals" 1 {2.50G} - 225.70G + -2.50G "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - 55.70G + -172.50G "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - 55.97G + -172.22G "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - 56.25G + -171.95G "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - 55.70G + -172.50G "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - 55.70G + -172.50G Nightblade 1 {200.00G} "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - -144.30G + -372.50G Nightblade 1 {200.00G} "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - -142.53G + -370.73G Nightblade 1 {200.00G} "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - -140.76G + -368.96G Nightblade 1 {200.00G} "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - -138.99G + -367.19G Nightblade 1 {200.00G} "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - -137.22G + -365.42G Nightblade 1 {200.00G} "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - -136.47G + -364.67G Nightblade 1 {200.00G} "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - -144.30G + -372.50G Nightblade 1 {200.00G} "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - 22.22G + -205.97G Nightblade 1 {200.00G} "Orb of Deception" 1 {170.00G} "Two of Portals" 1 {2.50G} - 22.22G - Nightblade 1 {200.00G} - "Two of Portals" 1 {2.50G} - 25.70G + -205.97G Nightblade 1 {200.00G} "Two of Portals" 1 {2.50G} - 22.22G + -202.50G Nightblade 1 {200.00G} "Two of Portals" 1 {2.50G} - 30.42G + -194.30G Nightblade 1 {200.00G} "Two of Portals" 1 {2.50G} - 30.42G - Nightblade 1 {200.00G} - 24.72G + -194.30G Nightblade 1 {200.00G} - 30.42G + -200.00G Nightblade 1 {200.00G} - 31.92G + -198.50G Nightblade 1 {200.00G} - 31.92G + -198.50G Nightblade 1 {200.00G} - 31.93G + -198.49G Nightblade 1 {200.00G} - 30.42G + -200.00G Nightblade 1 {200.00G} - 190.42G + -40.00G Nightblade 1 {200.00G} - 190.42G - 230.42G - 190.42G - 190.42G - 190.42G - 244.42G - 254.42G - 264.42G - 264.48G - 264.52G - 264.52G - 190.42G - 190.42G + -40.00G + 0 + 30c + 0 + 54.00G + 64.00G + 74.00G + 74.06G + 74.10G + 74.10G + 0 "Orb of Deception" 1 {155.00G} - 35.42G + -155.00G "Orb of Deception" 1 {155.00G} end test diff --git a/test/baseline/opt-lots-actual.test b/test/baseline/opt-lots-actual.test index 395b0eaf..6cd9b2f4 100644 --- a/test/baseline/opt-lots-actual.test +++ b/test/baseline/opt-lots-actual.test @@ -5,7 +5,7 @@ D 1.0000s Assets:Gruulmorg 248720c @ 10.051463493s Equity:Gold -5000000s -test reg --format '%(justify(scrub(total_expr), 40, 40, true))\n' --lots +test reg --format '%(justify(scrub(total_expr), 40, 40, true))\n' --lots --date-format %Y/%m/%d 1339829c {1.86590975416s} [2006/03/14] 1339829c {1.86590975416s} [2006/03/14] 248720c {10.051463493s} [2006/03/14] diff --git a/test/baseline/opt-lots.test b/test/baseline/opt-lots.test index bd47fb1e..068d1000 100644 --- a/test/baseline/opt-lots.test +++ b/test/baseline/opt-lots.test @@ -549,7 +549,7 @@ D 1.00G Assets:Tajer:Items "Orb of Deception" 1 @ 155G Assets:Tajer -test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots +test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots --date-format %Y/%m/%d 133.98G 158.85G 0 @@ -860,15 +860,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -877,7 +869,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -887,7 +879,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -898,7 +890,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -910,7 +902,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} @@ -921,7 +913,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -931,7 +923,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -940,7 +932,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -948,7 +940,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 50.42G + -4.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -956,7 +948,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -964,7 +956,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 59.83G + 5.25G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -972,7 +964,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -980,7 +972,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -988,7 +980,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -996,7 +988,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1004,7 +996,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.43G + -8.14G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1012,7 +1004,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1020,7 +1012,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.66G + -7.92G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1028,7 +1020,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.78G + -7.80G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1036,7 +1028,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.90G + -7.68G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1044,7 +1036,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.91G + -7.67G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1052,7 +1044,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.92G + -7.66G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1060,7 +1052,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1068,7 +1060,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.82G + -7.75G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1076,7 +1068,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 47.22G + -7.36G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1084,7 +1076,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1092,7 +1084,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.43G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1100,7 +1092,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 51.43G + -3.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1108,7 +1100,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1116,7 +1108,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1124,7 +1116,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.42G + 11.85G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1132,7 +1124,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1140,7 +1132,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 46.42G + -8.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1149,7 +1141,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 45.42G + -9.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1158,7 +1150,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 45.52G + -9.06G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1167,7 +1159,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 45.42G + -9.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1176,7 +1168,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 45.42G + -9.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1185,7 +1177,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 75.42G + 20.85G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1194,7 +1186,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 45.42G + -9.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1204,7 +1196,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 45.42G + -9.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1214,7 +1206,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1225,117 +1217,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 15.42G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 15.42G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 15.43G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 15.42G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 15.43G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 15.42G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 15.63G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 15.42G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 16.17G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 16.92G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 15.42G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1345,7 +1227,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1355,7 +1237,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 15.43G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1365,7 +1247,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1375,7 +1257,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 15.43G + -39.14G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1385,7 +1267,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1395,7 +1277,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 15.43G + -38.94G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1405,7 +1287,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 15.42G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1415,7 +1297,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 16.42G + -38.40G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1425,7 +1307,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 15.42G + -37.65G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1435,7 +1317,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 33.48G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] @@ -1445,745 +1327,434 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 33.48G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 16.92G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 33.48G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 51.54G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 51.54G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 34.48G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 51.54G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 51.54G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 51.54G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 51.54G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 51.54G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.29G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 51.54G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 51.57G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} - "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] - "Beaststalker's Belt" 1 {65.00G} [2006/03/15] - "Beaststalker's Belt" -1 {65.00G} - 51.54G - "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.54G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.54G + -38.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.79G + -39.15G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.54G + -21.10G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 55.33G + -21.10G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.54G + -37.65G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.54G + -19.60G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] - "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.54G + -19.60G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.54G - "Holy Bologna" 1 {2.00G} [2006/03/17] + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.54G - "Holy Bologna" 1 {2.00G} [2006/03/17] + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Emerald Dream" 1 {4.00G} [2006/03/17] - "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.54G - "Holy Bologna" 1 {2.00G} [2006/03/17] + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] - "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] - "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.54G - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.54G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 52.54G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -35.91G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 25.64G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 29.64G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -36.62G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 29.64G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -36.65G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 26.64G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -35.65G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] - "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 29.64G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -35.65G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 29.96G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -35.40G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 29.96G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -32.62G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 32.64G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -35.40G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} - "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 29.96G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -35.40G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 31.21G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Holy Bologna" 1 {2.00G} [2006/03/17] + -35.40G "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 29.96G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] + -35.40G "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 44.96G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] + -35.40G "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} - "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 44.96G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Harnessing Shadows" 1 {5.00G} [2006/03/17] + -35.40G "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] @@ -2192,23 +1763,19 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 29.96G - "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] + -35.40G "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] @@ -2217,13 +1784,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.20G + -35.40G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2231,9 +1797,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} - "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] @@ -2242,24 +1806,21 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.20G + -35.40G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] @@ -2268,25 +1829,21 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.20G + -62.31G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] @@ -2295,25 +1852,21 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 34.36G + -58.31G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] - "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] @@ -2322,20 +1875,17 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 50.38G + -58.31G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] @@ -2349,20 +1899,17 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.20G + -61.31G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] @@ -2376,20 +1923,17 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Ace of Warlords" 1 {3.00G} [2006/03/17] - "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 116.16G + -60.99G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] @@ -2409,14 +1953,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 117.16G + -60.99G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] @@ -2436,14 +1978,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 117.16G + -58.31G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] @@ -2463,14 +2003,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.20G + -57.05G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] @@ -2490,14 +2028,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.21G + -58.31G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] @@ -2517,14 +2053,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.23G + -43.31G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] @@ -2544,14 +2078,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.20G + -43.30G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] @@ -2571,14 +2103,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 112.12G + -58.31G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] @@ -2598,14 +2128,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 120.22G + -22.06G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] @@ -2625,14 +2153,13 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.20G + -22.06G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] - "Plans: Mithril Shield Spike" -1 {2.30G} "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] @@ -2652,7 +2179,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 132.45G + -22.06G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2679,7 +2206,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 132.45G + -53.90G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2706,7 +2233,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.20G + -3.94G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2733,7 +2260,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.95G + -2.94G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2760,7 +2287,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.95G + -2.94G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2787,7 +2314,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 66.20G + -53.90G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2814,7 +2341,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 81.20G + -53.89G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2837,12 +2364,11 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] - "Ace of Warlords" -1 {3.90G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 81.20G + -53.87G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2865,12 +2391,11 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] - "Ace of Warlords" -1 {3.90G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 70.10G + -53.90G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2893,12 +2418,11 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] - "Ace of Warlords" -1 {3.90G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 81.20G + -7.98G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2921,12 +2445,10 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] - "Ace of Warlords" -1 {3.90G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 124.65G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2946,15 +2468,15 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] + 12.34s "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] - "Ace of Warlords" -1 {3.90G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 124.65G + -53.90G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -2974,16 +2496,14 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] - "Ace of Warlords" -1 {3.90G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 111.20G + 12.35G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -3003,16 +2523,14 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] - "Ace of Warlords" -1 {3.90G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 124.65G + 12.35G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -3032,16 +2550,14 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] - "Ace of Warlords" -1 {3.90G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 144.60G + -53.90G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -3061,19 +2577,16 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] - "Ace of Warlords" -1 {3.90G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 144.60G + -53.15G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -3091,19 +2604,16 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] - "Ace of Warlords" -1 {3.90G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 129.65G + -53.15G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -3121,19 +2631,16 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] - "Ace of Warlords" -1 {3.90G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 144.60G + -53.90G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -3151,19 +2658,16 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] - "Ace of Warlords" -1 {3.90G} "Ace of Warlords" 2 {15.00G} [2006/03/16] "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 173.10G + -38.90G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -3181,7 +2685,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] @@ -3190,11 +2693,9 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 173.10G + -38.90G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -3212,7 +2713,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] @@ -3221,11 +2721,9 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 148.60G + -50.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -3243,7 +2741,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] @@ -3252,11 +2749,9 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 173.10G + -6.55G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -3274,7 +2769,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] - "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] @@ -3283,11 +2777,9 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 190.20G + -6.55G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -3314,11 +2806,9 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 190.20G + -20.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -3334,7 +2824,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} @@ -3346,11 +2835,8 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 177.10G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] - "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -3366,10 +2852,10 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} + -5.00s "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] @@ -3378,9 +2864,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 190.20G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -3398,10 +2882,10 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} + -5.00s "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] @@ -3410,9 +2894,8 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 194.85G + -15.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -3430,7 +2913,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} @@ -3442,9 +2924,8 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 194.85G + 13.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] - "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] @@ -3455,7 +2936,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] - "Preserved Holly" -5 {20.00s} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] @@ -3463,7 +2943,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} @@ -3475,7 +2954,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 191.20G + 13.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -3488,7 +2967,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] - "Preserved Holly" -5 {20.00s} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] @@ -3496,7 +2974,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} @@ -3508,7 +2985,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 194.85G + -11.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -3521,7 +2998,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] - "Preserved Holly" -5 {20.00s} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] @@ -3529,7 +3005,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} @@ -3541,7 +3016,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 194.85G + 6.10G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -3554,7 +3029,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] - "Preserved Holly" -5 {20.00s} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] @@ -3562,9 +3036,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Recipe: Elixir of Giant Growth" 1 {1.50G} [2006/03/15] "Recipe: Elixir of Giant Growth" -1 {1.50G} "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] - "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] - "Two of Portals" 1 {3.00G} [2006/03/19] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] @@ -3575,7 +3047,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 194.85G + 6.10G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -3588,7 +3060,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] - "Preserved Holly" -5 {20.00s} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] @@ -3598,8 +3069,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] - "Two of Portals" 1 {2.50G} [2006/03/19] - "Two of Portals" 1 {3.00G} [2006/03/19] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] @@ -3610,7 +3079,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 189.35G + -7.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -3623,7 +3092,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] - "Preserved Holly" -5 {20.00s} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] @@ -3633,8 +3101,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] - "Two of Portals" 1 {2.50G} [2006/03/19] - "Two of Portals" 1 {3.00G} [2006/03/19] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] @@ -3645,7 +3111,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 205.70G + -2.35G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -3658,7 +3124,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Plans: Wildthorn Mail" 1 {1.25G} [2006/03/14] "Plans: Wildthorn Mail" -1 {1.25G} "Preserved Holly" 5 {20.00s} [2006/03/17] - "Preserved Holly" -5 {20.00s} "Pulsating Hydra Heart" 1 {1.00G} [2006/03/16] "Pulsating Hydra Heart" -1 {1.00G} "Recipe: Elixir of Giant Growth" 1 {1.00G} [2006/03/15] @@ -3668,8 +3133,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] - "Two of Portals" 1 {2.50G} [2006/03/19] - "Two of Portals" 1 {3.00G} [2006/03/19] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] @@ -3680,13 +3143,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 205.70G + -2.35G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] - "Holy Bologna" -1 {2.00G} "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -3704,8 +3166,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] - "Two of Portals" 1 {2.50G} [2006/03/19] - "Two of Portals" 1 {3.00G} [2006/03/19] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] @@ -3716,13 +3176,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 191.35G + -6.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] - "Holy Bologna" -1 {2.00G} "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -3740,8 +3199,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] - "Two of Portals" 1 {2.50G} [2006/03/19] - "Two of Portals" 1 {3.00G} [2006/03/19] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] @@ -3752,13 +3209,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 205.70G + -6.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] - "Holy Bologna" -1 {2.00G} "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -3776,7 +3232,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] - "Two of Portals" 1 {2.50G} [2006/03/19] "Two of Portals" 1 {3.00G} [2006/03/19] "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} @@ -3788,13 +3243,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 210.70G + -6.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] - "Holy Bologna" -1 {2.00G} "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -3824,13 +3278,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 210.70G + -11.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] - "Holy Bologna" -1 {2.00G} "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -3850,7 +3303,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "Two of Portals" 1 {2.50G} [2006/03/19] "Two of Portals" 1 {3.00G} [2006/03/19] - "Two of Portals" -1 {3.00G} "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] @@ -3861,13 +3313,12 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 208.70G + 4.84G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] - "Holy Bologna" -1 {2.00G} "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -3887,7 +3338,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "Two of Portals" 1 {2.50G} [2006/03/19] "Two of Portals" 1 {3.00G} [2006/03/19] - "Two of Portals" -1 {3.00G} "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] @@ -3898,7 +3348,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 210.70G + 4.84G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -3924,7 +3374,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "Two of Portals" 1 {2.50G} [2006/03/19] "Two of Portals" 1 {3.00G} [2006/03/19] - "Two of Portals" -1 {3.00G} "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] @@ -3935,7 +3384,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 225.70G + -9.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -3961,7 +3410,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "Two of Portals" 1 {2.50G} [2006/03/19] "Two of Portals" 1 {3.00G} [2006/03/19] - "Two of Portals" -1 {3.00G} "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] @@ -3972,7 +3420,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 225.70G + -4.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -3996,10 +3444,8 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] - "The Emerald Dream" -1 {4.00G} "Two of Portals" 1 {2.50G} [2006/03/19] "Two of Portals" 1 {3.00G} [2006/03/19] - "Two of Portals" -1 {3.00G} "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} "Ace of Warlords" 1 {3.00G} [2006/03/17] @@ -4010,7 +3456,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 214.70G + -4.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4034,7 +3480,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] - "The Emerald Dream" -1 {4.00G} "Two of Portals" 1 {2.50G} [2006/03/19] "Two of Portals" 1 {3.00G} [2006/03/19] "Two of Portals" -1 {3.00G} @@ -4048,7 +3493,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 225.70G + -6.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4072,7 +3517,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] - "The Emerald Dream" -1 {4.00G} "Two of Portals" 1 {2.50G} [2006/03/19] "Two of Portals" 1 {3.00G} [2006/03/19] "Two of Portals" -1 {3.00G} @@ -4086,7 +3530,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 225.70G + 8.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4110,7 +3554,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Arcanist's Cookbook" 1 {4.00G} [2006/03/17] "The Arcanist's Cookbook" -1 {4.00G} "The Emerald Dream" 1 {4.00G} [2006/03/17] - "The Emerald Dream" -1 {4.00G} "Two of Portals" 1 {2.50G} [2006/03/19] "Two of Portals" 1 {3.00G} [2006/03/19] "Two of Portals" -1 {3.00G} @@ -4124,7 +3567,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 225.70G + 8.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4162,14 +3605,13 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 225.70G + -2.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Holy Bologna" -1 {2.00G} - "Orb of Deception" 1 {170.00G} [2006/03/21] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -4201,14 +3643,13 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 55.70G + -2.49G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Holy Bologna" -1 {2.00G} - "Orb of Deception" 1 {170.00G} [2006/03/21] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -4240,14 +3681,13 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 55.97G + -2.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Holy Bologna" -1 {2.00G} - "Orb of Deception" 1 {170.00G} [2006/03/21] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -4279,7 +3719,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 56.25G + -2.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4318,7 +3758,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 55.70G + -172.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4357,14 +3797,13 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 55.70G + -172.22G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Holy Bologna" -1 {2.00G} - Nightblade 1 {200.00G} [2006/03/22] "Orb of Deception" 1 {170.00G} [2006/03/21] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -4397,14 +3836,13 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - -144.30G + -171.95G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Holy Bologna" -1 {2.00G} - Nightblade 1 {200.00G} [2006/03/22] "Orb of Deception" 1 {170.00G} [2006/03/21] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -4437,14 +3875,13 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - -142.53G + -172.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] "Harnessing Shadows" -1 {5.00G} "Holy Bologna" 1 {2.00G} [2006/03/17] "Holy Bologna" -1 {2.00G} - Nightblade 1 {200.00G} [2006/03/22] "Orb of Deception" 1 {170.00G} [2006/03/21] "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} @@ -4477,7 +3914,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - -140.76G + -172.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4517,7 +3954,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - -138.99G + -372.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4557,7 +3994,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - -137.22G + -370.73G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4597,7 +4034,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - -136.47G + -368.96G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4637,7 +4074,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - -144.30G + -367.19G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4677,7 +4114,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 22.22G + -365.42G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4717,7 +4154,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 22.22G + -364.67G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4726,7 +4163,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Holy Bologna" -1 {2.00G} Nightblade 1 {200.00G} [2006/03/22] "Orb of Deception" 1 {170.00G} [2006/03/21] - "Orb of Deception" -1 {170.00G} "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -4758,7 +4194,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 25.70G + -372.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4767,7 +4203,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Holy Bologna" -1 {2.00G} Nightblade 1 {200.00G} [2006/03/22] "Orb of Deception" 1 {170.00G} [2006/03/21] - "Orb of Deception" -1 {170.00G} "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -4799,7 +4234,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 22.22G + -205.97G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4808,7 +4243,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Holy Bologna" -1 {2.00G} Nightblade 1 {200.00G} [2006/03/22] "Orb of Deception" 1 {170.00G} [2006/03/21] - "Orb of Deception" -1 {170.00G} "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] "Plans: Mithril Shield Spike" -1 {2.105G} "Plans: Mithril Shield Spike" 1 {2.30G} [2006/03/15] @@ -4840,7 +4274,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 30.42G + -205.97G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4881,7 +4315,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 30.42G + -202.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4910,7 +4344,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "The Emerald Dream" -1 {4.00G} "Two of Portals" 1 {2.50G} [2006/03/19] - "Two of Portals" -1 {2.50G} "Two of Portals" 1 {3.00G} [2006/03/19] "Two of Portals" -1 {3.00G} "Wildheart Belt" 1 {30.00G} [2006/03/17] @@ -4923,7 +4356,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 24.72G + -194.30G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -4952,7 +4385,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "The Emerald Dream" 1 {4.00G} [2006/03/17] "The Emerald Dream" -1 {4.00G} "Two of Portals" 1 {2.50G} [2006/03/19] - "Two of Portals" -1 {2.50G} "Two of Portals" 1 {3.00G} [2006/03/19] "Two of Portals" -1 {3.00G} "Wildheart Belt" 1 {30.00G} [2006/03/17] @@ -4965,7 +4397,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 30.42G + -194.30G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5007,7 +4439,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 31.92G + -200.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5049,7 +4481,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 31.92G + -198.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5091,7 +4523,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 31.93G + -198.50G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5133,7 +4565,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 30.42G + -198.49G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5175,7 +4607,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 190.42G + -200.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5217,7 +4649,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 190.42G + -40.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5225,7 +4657,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Holy Bologna" 1 {2.00G} [2006/03/17] "Holy Bologna" -1 {2.00G} Nightblade 1 {200.00G} [2006/03/22] - Nightblade -1 {200.00G} "Orb of Deception" 1 {170.00G} [2006/03/21] "Orb of Deception" -1 {170.00G} "Plans: Mithril Shield Spike" 1 {2.105G} [2006/03/15] @@ -5260,7 +4691,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 230.42G + -40.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5303,7 +4734,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 190.42G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5346,7 +4776,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 190.42G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5381,6 +4810,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Two of Portals" -1 {3.00G} "Wildheart Belt" 1 {30.00G} [2006/03/17] "Wildheart Belt" -1 {30.00G} + 30c "Ace of Warlords" 1 {3.00G} [2006/03/17] "Ace of Warlords" -1 {3.00G} "Ace of Warlords" 1 {3.90G} [2006/03/17] @@ -5389,7 +4819,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 190.42G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5432,7 +4861,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 244.42G + 54.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5475,7 +4904,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 254.42G + 64.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5518,7 +4947,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 264.42G + 74.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5561,7 +4990,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 264.48G + 74.06G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5604,7 +5033,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 264.52G + 74.10G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5647,7 +5076,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 264.52G + 74.10G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5690,7 +5119,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 190.42G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5733,7 +5161,6 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 190.42G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] @@ -5777,7 +5204,7 @@ test reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots "Ace of Warlords" -2 {15.00G} [2006/03/17] "Beaststalker's Belt" 1 {65.00G} [2006/03/15] "Beaststalker's Belt" -1 {65.00G} - 35.42G + -155.00G "Garona: Book on Treachery" 1 {4.00G} [2006/03/17] "Garona: Book on Treachery" -1 {4.00G} "Harnessing Shadows" 1 {5.00G} [2006/03/17] diff --git a/test/baseline/opt-lots_basis.test b/test/baseline/opt-lots_basis.test index 62c49ee1..2491426b 100644 --- a/test/baseline/opt-lots_basis.test +++ b/test/baseline/opt-lots_basis.test @@ -676,9 +676,8 @@ test reg --basis 06-Mar-16 Post Expenses:Fees:Mail 90c 90c Assets:Tajer -90c 0 06-Mar-16 Auction House Assets:Tajer 119.58G 119.58G - Assets:Tajer:Items -119.58G 0 - Income:Brokering -54.58G -54.58G - Equity:Capital Gains 54.58G 0 + Assets:Tajer:Items -65.00G 54.58G + Income:Brokering -54.58G 0 06-Mar-16 Auction House Assets:Wyshona:Items "Plans: Mithril Shield Spike" 1 "Plans: Mithril Shield Spike" 1 Assets:Wyshona:Items "Plans: Mithril Shield Spike" 1 "Plans: Mithril Shield Spike" 2 Assets:Wyshona:Items "Recipe: Elixir of Giant Growth" 1 "Plans: Mithril Shield Spike" 2 @@ -745,13 +744,11 @@ test reg --basis 06-Mar-16 Player Assets:Tajer 1.00G 1.00G Equity:Gold -1.00G 0 06-Mar-17 Auction House Assets:Wyshona 18.06G 18.06G - Assets:Wyshona:Items -18.06G 0 - Income:Brokering -16.56G -16.56G - Equity:Capital Gains 16.56G 0 + Assets:Wyshona:Items -1.50G 16.56G + Income:Brokering -16.56G 0 06-Mar-17 Auction House Assets:Wyshona 18.06G 18.06G - Assets:Wyshona:Items -18.06G 0 - Income:Brokering -17.06G -17.06G - Equity:Capital Gains 17.06G 0 + Assets:Wyshona:Items -1.00G 17.06G + Income:Brokering -17.06G 0 06-Mar-17 Post Expenses:Fees:Mail 30c 30c Assets:Tajer -30c 0 06-Mar-17 Player: raev Assets:Tajer:Items 30.00G 30.00G @@ -761,9 +758,8 @@ test reg --basis 06-Mar-17 Post Expenses:Fees:Mail 3.00s 3.00s Assets:Wyshona -3.00s 0 06-Mar-17 Player Assets:Wyshona 1.00G 1.00G - Assets:Wyshona:Items -1.00G 0 - Expenses:Capital Loss 25.00s 25.00s - Equity:Capital Losses -25.00s 0 + Assets:Wyshona:Items -1.25G -25.00s + Expenses:Capital Loss 25.00s 0 06-Mar-17 Auction House (impl.. Expenses:Items 2.79G 2.79G Assets:Wyshona -2.79G 0 06-Mar-17 Auction House (impl.. Assets:Danell:Items 3.00G 3.00G @@ -776,24 +772,20 @@ test reg --basis Assets:Tajer:Items 1.00G 26.90G Assets:Wyshona -26.90G 0 06-Mar-17 Auction House Assets:Tajer 4.00G 4.00G - Assets:Tajer:Items -4.00G 0 - Income:Brokering -3.00G -3.00G - Equity:Capital Gains 3.00G 0 + Assets:Tajer:Items -1.00G 3.00G + Income:Brokering -3.00G 0 06-Mar-17 Auction House Assets:Danell 31.71s 31.71s - Assets:Danell:Items -31.71s 0 - Expenses:Capital Loss 2.68G 2.68G - Equity:Capital Losses -2.68G 0 + Assets:Danell:Items -3.00G -2.68G + Expenses:Capital Loss 2.68G 0 06-Mar-17 Auction House Expenses:Fees:Auction 1.25G 1.25G Assets:Danell -1.25G 0 06-Mar-17 Transfer Assets:Gruulmorg 15.00G 15.00G Expenses:Fees:Mail 30c 15.00G Assets:Tajer -15.00G 0 06-Mar-17 Auction House Assets:Wyshona 36.25G 36.25G - Assets:Wyshona:Items -18.12G 18.12G - Assets:Wyshona:Items -18.12G 0 - Income:Brokering -31.84G -31.84G - Equity:Capital Gains 16.02G -15.82G - Equity:Capital Gains 15.82G 0 + Assets:Wyshona:Items -2.11G 34.14G + Assets:Wyshona:Items -2.30G 31.84G + Income:Brokering -31.84G 0 06-Mar-17 Transfer Assets:Danell 49.96G 49.96G Expenses:Gifts 1.00G 50.96G Expenses:Fees:Mail 30c 50.96G @@ -811,44 +803,35 @@ test reg --basis Expenses:Fees:Mail 30c 75.30s Assets:Tajer -75.30s 0 06-Mar-18 Auction House Assets:Tajer 15.00G 15.00G - Assets:Tajer:Items -15.00G 0 - Income:Brokering -11.10G -11.10G - Equity:Capital Gains 11.10G 0 + Assets:Tajer:Items -3.90G 11.10G + Income:Brokering -11.10G 0 06-Mar-18 Auction House Assets:Tajer 43.45G 43.45G - Assets:Tajer:Items -43.45G 0 - Income:Brokering -13.45G -13.45G - Equity:Capital Gains 13.45G 0 + Assets:Tajer:Items -30.00G 13.45G + Income:Brokering -13.45G 0 06-Mar-18 Auction House Assets:Tajer 19.95G 19.95G - Assets:Tajer:Items -19.95G 0 - Income:Brokering -14.95G -14.95G - Equity:Capital Gains 14.95G 0 + Assets:Tajer:Items -5.00G 14.95G + Income:Brokering -14.95G 0 06-Mar-19 Auction House Assets:Tajer 28.50G 28.50G - Assets:Tajer:Items -28.50G 0 - Income:Brokering -24.50G -24.50G - Equity:Capital Gains 24.50G 0 + Assets:Tajer:Items -4.00G 24.50G + Income:Brokering -24.50G 0 06-Mar-19 Auction House Assets:Tajer 17.10G 17.10G - Assets:Tajer:Items -17.10G 0 - Income:Brokering -13.10G -13.10G - Equity:Capital Gains 13.10G 0 + Assets:Tajer:Items -4.00G 13.10G + Income:Brokering -13.10G 0 06-Mar-19 Auction House Assets:Tajer 4.65G 4.65G - Assets:Tajer:Items -4.65G 0 - Income:Brokering -3.65G -3.65G - Equity:Capital Gains 3.65G 0 + Assets:Tajer:Items -1.00G 3.65G + Income:Brokering -3.65G 0 06-Mar-19 Auction House Assets:Tajer:Items 3.00G 3.00G Assets:Tajer:Items 2.50G 5.50G Assets:Tajer -5.50G 0 06-Mar-20 Auction House Assets:Tajer 16.34G 16.34G - Assets:Tajer:Items -16.34G 0 - Income:Brokering -14.34G -14.34G - Equity:Capital Gains 14.34G 0 + Assets:Tajer:Items -2.00G 14.34G + Income:Brokering -14.34G 0 06-Mar-20 Auction House Assets:Tajer 5.00G 5.00G - Assets:Tajer:Items -5.00G 0 - Income:Brokering -2.00G -2.00G - Equity:Capital Gains 2.00G 0 + Assets:Tajer:Items -3.00G 2.00G + Income:Brokering -2.00G 0 06-Mar-20 Auction House Assets:Tajer 15.00G 15.00G - Assets:Tajer:Items -15.00G 0 - Income:Brokering -11.00G -11.00G - Equity:Capital Gains 11.00G 0 + Assets:Tajer:Items -4.00G 11.00G + Income:Brokering -11.00G 0 06-Mar-20 Auction House Expenses:Fees:Mail 60c 60c Assets:Tajer -60c 0 06-Mar-21 Auction House Assets:Tajer:Items 170.00G 170.00G @@ -865,21 +848,18 @@ test reg --basis Expenses:Fees:Auction 75.00s 7.83G Assets:Tajer -7.83G 0 06-Mar-23 Auction House Assets:Tajer 166.53G 166.53G - Assets:Tajer:Items -166.53G 0 - Expenses:Capital Loss 3.47G 3.47G - Equity:Capital Losses -3.47G 0 + Assets:Tajer:Items -170.00G -3.47G + Expenses:Capital Loss 3.47G 0 06-Mar-26 Auction House Assets:Tajer 8.20G 8.20G - Assets:Tajer:Items -8.20G 0 - Income:Brokering -5.70G -5.70G - Equity:Capital Gains 5.70G 0 + Assets:Tajer:Items -2.50G 5.70G + Income:Brokering -5.70G 0 06-Mar-26 Player Expenses:Items 1.50G 1.50G Expenses:Fees:Mail 30c 1.50G Expenses:Fees:Mail 30c 1.51G Assets:Tajer -1.51G 0 06-Mar-27 Player Assets:Tajer 160.00G 160.00G - Assets:Tajer:Items -160.00G 0 - Expenses:Capital Loss 40.00G 40.00G - Equity:Capital Losses -40.00G 0 + Assets:Tajer:Items -200.00G -40.00G + Expenses:Capital Loss 40.00G 0 06-Mar-27 Player Expenses:Fees:Mail 30c 30c Assets:Tajer -30c 0 06-Mar-26 Player Expenses:Items 54.00G 54.00G diff --git a/test/baseline/opt-lots_basis_base.test b/test/baseline/opt-lots_basis_base.test index 5eecf8fa..3ba30405 100644 --- a/test/baseline/opt-lots_basis_base.test +++ b/test/baseline/opt-lots_basis_base.test @@ -677,9 +677,8 @@ test reg --basis --base 06-Mar-16 Post Expenses:Fees:Mail 90c 90c Assets:Tajer -90c 0 06-Mar-16 Auction House Assets:Tajer 1195768c 1195768c - Assets:Tajer:Items -1195768c 0 - Income:Brokering -545768c -545768c - Equity:Capital Gains 545768c 0 + Assets:Tajer:Items -650000c 545768c + Income:Brokering -545768c 0 06-Mar-16 Auction House Assets:Wyshona:Items "Plans: Mithril Shield Spike" 1 "Plans: Mithril Shield Spike" 1 Assets:Wyshona:Items "Plans: Mithril Shield Spike" 1 "Plans: Mithril Shield Spike" 2 Assets:Wyshona:Items "Recipe: Elixir of Giant Growth" 1 "Plans: Mithril Shield Spike" 2 @@ -746,13 +745,11 @@ test reg --basis --base 06-Mar-16 Player Assets:Tajer 10000c 10000c Equity:Gold -10000c 0 06-Mar-17 Auction House Assets:Wyshona 180584c 180584c - Assets:Wyshona:Items -180584c 0 - Income:Brokering -165584c -165584c - Equity:Capital Gains 165584c 0 + Assets:Wyshona:Items -15000c 165584c + Income:Brokering -165584c 0 06-Mar-17 Auction House Assets:Wyshona 180584c 180584c - Assets:Wyshona:Items -180584c 0 - Income:Brokering -170584c -170584c - Equity:Capital Gains 170584c 0 + Assets:Wyshona:Items -10000c 170584c + Income:Brokering -170584c 0 06-Mar-17 Post Expenses:Fees:Mail 30c 30c Assets:Tajer -30c 0 06-Mar-17 Player: raev Assets:Tajer:Items 300000c 300000c @@ -762,9 +759,8 @@ test reg --basis --base 06-Mar-17 Post Expenses:Fees:Mail 300c 300c Assets:Wyshona -300c 0 06-Mar-17 Player Assets:Wyshona 10000c 10000c - Assets:Wyshona:Items -10000c 0 - Expenses:Capital Loss 2500c 2500c - Equity:Capital Losses -2500c 0 + Assets:Wyshona:Items -12500c -2500c + Expenses:Capital Loss 2500c 0 06-Mar-17 Auction House (impl.. Expenses:Items 27900c 27900c Assets:Wyshona -27900c 0 06-Mar-17 Auction House (impl.. Assets:Danell:Items 30000c 30000c @@ -777,24 +773,20 @@ test reg --basis --base Assets:Tajer:Items 10000c 269000c Assets:Wyshona -269000c 0 06-Mar-17 Auction House Assets:Tajer 40000c 40000c - Assets:Tajer:Items -40000c 0 - Income:Brokering -30000c -30000c - Equity:Capital Gains 30000c 0 + Assets:Tajer:Items -10000c 30000c + Income:Brokering -30000c 0 06-Mar-17 Auction House Assets:Danell 3171c 3171c - Assets:Danell:Items -3171c 0 - Expenses:Capital Loss 26829c 26829c - Equity:Capital Losses -26829c 0 + Assets:Danell:Items -30000c -26829c + Expenses:Capital Loss 26829c 0 06-Mar-17 Auction House Expenses:Fees:Auction 12537c 12537c Assets:Danell -12537c 0 06-Mar-17 Transfer Assets:Gruulmorg 150000c 150000c Expenses:Fees:Mail 30c 150030c Assets:Tajer -150030c 0 06-Mar-17 Auction House Assets:Wyshona 362450c 362450c - Assets:Wyshona:Items -181225c 181225c - Assets:Wyshona:Items -181225c 0 - Income:Brokering -318400c -318400c - Equity:Capital Gains 160175c -158225c - Equity:Capital Gains 158225c 0 + Assets:Wyshona:Items -21050c 341400c + Assets:Wyshona:Items -23000c 318400c + Income:Brokering -318400c 0 06-Mar-17 Transfer Assets:Danell 499560c 499560c Expenses:Gifts 10000c 509560c Expenses:Fees:Mail 30c 509590c @@ -812,44 +804,35 @@ test reg --basis --base Expenses:Fees:Mail 30c 7530c Assets:Tajer -7530c 0 06-Mar-18 Auction House Assets:Tajer 150000c 150000c - Assets:Tajer:Items -150000c 0 - Income:Brokering -111000c -111000c - Equity:Capital Gains 111000c 0 + Assets:Tajer:Items -39000c 111000c + Income:Brokering -111000c 0 06-Mar-18 Auction House Assets:Tajer 434472c 434472c - Assets:Tajer:Items -434472c 0 - Income:Brokering -134472c -134472c - Equity:Capital Gains 134472c 0 + Assets:Tajer:Items -300000c 134472c + Income:Brokering -134472c 0 06-Mar-18 Auction House Assets:Tajer 199500c 199500c - Assets:Tajer:Items -199500c 0 - Income:Brokering -149500c -149500c - Equity:Capital Gains 149500c 0 + Assets:Tajer:Items -50000c 149500c + Income:Brokering -149500c 0 06-Mar-19 Auction House Assets:Tajer 285000c 285000c - Assets:Tajer:Items -285000c 0 - Income:Brokering -245000c -245000c - Equity:Capital Gains 245000c 0 + Assets:Tajer:Items -40000c 245000c + Income:Brokering -245000c 0 06-Mar-19 Auction House Assets:Tajer 171000c 171000c - Assets:Tajer:Items -171000c 0 - Income:Brokering -131000c -131000c - Equity:Capital Gains 131000c 0 + Assets:Tajer:Items -40000c 131000c + Income:Brokering -131000c 0 06-Mar-19 Auction House Assets:Tajer 46550c 46550c - Assets:Tajer:Items -46550c 0 - Income:Brokering -36550c -36550c - Equity:Capital Gains 36550c 0 + Assets:Tajer:Items -10000c 36550c + Income:Brokering -36550c 0 06-Mar-19 Auction House Assets:Tajer:Items 30000c 30000c Assets:Tajer:Items 25000c 55000c Assets:Tajer -55000c 0 06-Mar-20 Auction House Assets:Tajer 163443c 163443c - Assets:Tajer:Items -163443c 0 - Income:Brokering -143443c -143443c - Equity:Capital Gains 143443c 0 + Assets:Tajer:Items -20000c 143443c + Income:Brokering -143443c 0 06-Mar-20 Auction House Assets:Tajer 50000c 50000c - Assets:Tajer:Items -50000c 0 - Income:Brokering -20000c -20000c - Equity:Capital Gains 20000c 0 + Assets:Tajer:Items -30000c 20000c + Income:Brokering -20000c 0 06-Mar-20 Auction House Assets:Tajer 150000c 150000c - Assets:Tajer:Items -150000c 0 - Income:Brokering -110000c -110000c - Equity:Capital Gains 110000c 0 + Assets:Tajer:Items -40000c 110000c + Income:Brokering -110000c 0 06-Mar-20 Auction House Expenses:Fees:Mail 60c 60c Assets:Tajer -60c 0 06-Mar-21 Auction House Assets:Tajer:Items 1700000c 1700000c @@ -866,21 +849,18 @@ test reg --basis --base Expenses:Fees:Auction 7500c 78300c Assets:Tajer -78300c 0 06-Mar-23 Auction House Assets:Tajer 1665260c 1665260c - Assets:Tajer:Items -1665260c 0 - Expenses:Capital Loss 34740c 34740c - Equity:Capital Losses -34740c 0 + Assets:Tajer:Items -1700000c -34740c + Expenses:Capital Loss 34740c 0 06-Mar-26 Auction House Assets:Tajer 81980c 81980c - Assets:Tajer:Items -81980c 0 - Income:Brokering -56980c -56980c - Equity:Capital Gains 56980c 0 + Assets:Tajer:Items -25000c 56980c + Income:Brokering -56980c 0 06-Mar-26 Player Expenses:Items 15000c 15000c Expenses:Fees:Mail 30c 15030c Expenses:Fees:Mail 30c 15060c Assets:Tajer -15060c 0 06-Mar-27 Player Assets:Tajer 1600000c 1600000c - Assets:Tajer:Items -1600000c 0 - Expenses:Capital Loss 400000c 400000c - Equity:Capital Losses -400000c 0 + Assets:Tajer:Items -2000000c -400000c + Expenses:Capital Loss 400000c 0 06-Mar-27 Player Expenses:Fees:Mail 30c 30c Assets:Tajer -30c 0 06-Mar-26 Player Expenses:Items 540000c 540000c diff --git a/test/baseline/opt-no-aliases.test b/test/baseline/opt-no-aliases.test new file mode 100644 index 00000000..9deeca5d --- /dev/null +++ b/test/baseline/opt-no-aliases.test @@ -0,0 +1,20 @@ + +alias A=Foo + +account Bar + alias B + +2001-01-01 * Test + A 10 EUR + B + +test reg +01-Jan-01 Test Foo 10 EUR 10 EUR + Bar -10 EUR 0 +end test + +test reg --no-aliases +01-Jan-01 Test A 10 EUR 10 EUR + B -10 EUR 0 +end test + diff --git a/test/baseline/opt-pedantic.test b/test/baseline/opt-pedantic.test index fbb27b84..aca15410 100644 --- a/test/baseline/opt-pedantic.test +++ b/test/baseline/opt-pedantic.test @@ -8,7 +8,7 @@ test bal --pedantic -> 1 __ERROR__ -While parsing file "$FILE", line 2: +While parsing file "$FILE", line 2: While parsing posting: Expenses:Phone 20.00 GBP diff --git a/test/baseline/opt-pivot.test b/test/baseline/opt-pivot.test index e69de29b..595d8066 100644 --- a/test/baseline/opt-pivot.test +++ b/test/baseline/opt-pivot.test @@ -0,0 +1,148 @@ + +2014-01-01 * Opening balance + Assets:Cash 25.00 GBP + Equity:Opening balance -25.00 GBP + +2014-05-01 * Sell to customer AAA + ; Customer: AAA + ; Invoice: 101 + Assets:Receivables 10.00 GBP + Income:Sale -10.00 GBP + +2014-05-02 * Sell to customer BBB + ; Customer: BBB + ; Invoice: 102 + Assets:Receivables 11.00 GBP + Income:Sale -11.00 GBP + +2014-05-03 * Sell to customer AAA + ; Customer: AAA + ; Invoice: 103 + Assets:Receivables 12.00 GBP + Income:Sale -12.00 GBP + +2014-05-04 * Sell to customer CCC + ; Customer: CCC + ; Invoice: 104 + Assets:Receivables 15.00 GBP + Income:Sale -15.00 GBP + +2014-05-05 * Money received from customer AAA for invoice 101 + ; Customer: AAA + ; Invoice: 101 + Assets:Cash 10.00 GBP + Assets:Receivables -10.00 GBP + +2014-05-05 * Sell to customer DDD + ; Customer: DDD + ; Invoice: 105 + Assets:Receivables 20.00 GBP + Income:Sale -20.00 GBP + +2014-05-07 * Money received from customer CCC for invoice 104 + ; Customer: CCC + ; Invoice: 104 + Assets:Cash 15.00 GBP + Assets:Receivables -15.00 GBP + +2014-05-08 * Partial payment received from customer DDD for invoice 105 + ; Customer: DDD + ; Invoice: 105 + Assets:Cash 15.00 GBP + Assets:Receivables -15.00 GBP + +test bal assets:receivables --pivot Invoice + 28.00 GBP Invoice + 11.00 GBP 102:Assets:Receivables + 12.00 GBP 103:Assets:Receivables + 5.00 GBP 105:Assets:Receivables +-------------------- + 28.00 GBP +end test + +test bal assets:receivables --pivot Invoice --flat + 11.00 GBP Invoice:102:Assets:Receivables + 12.00 GBP Invoice:103:Assets:Receivables + 5.00 GBP Invoice:105:Assets:Receivables +-------------------- + 28.00 GBP +end test + +test bal assets:receivables --pivot Invoice --empty + 28.00 GBP Invoice + 0 101:Assets:Receivables + 11.00 GBP 102:Assets:Receivables + 12.00 GBP 103:Assets:Receivables + 0 104:Assets:Receivables + 5.00 GBP 105:Assets:Receivables +-------------------- + 28.00 GBP +end test + +test bal assets:receivables --pivot Invoice --empty -p "until 2014-05-05" + 48.00 GBP Invoice + 10.00 GBP 101:Assets:Receivables + 11.00 GBP 102:Assets:Receivables + 12.00 GBP 103:Assets:Receivables + 15.00 GBP 104:Assets:Receivables +-------------------- + 48.00 GBP +end test + +test bal assets:receivables --pivot Invoice --empty -p "until 2014-05-06" + 58.00 GBP Invoice + 0 101:Assets:Receivables + 11.00 GBP 102:Assets:Receivables + 12.00 GBP 103:Assets:Receivables + 15.00 GBP 104:Assets:Receivables + 20.00 GBP 105:Assets:Receivables +-------------------- + 58.00 GBP +end test + +test bal assets:receivables --pivot Customer + 28.00 GBP Customer + 12.00 GBP AAA:Assets:Receivables + 11.00 GBP BBB:Assets:Receivables + 5.00 GBP DDD:Assets:Receivables +-------------------- + 28.00 GBP +end test + +test bal assets:receivables --pivot Customer --flat + 12.00 GBP Customer:AAA:Assets:Receivables + 11.00 GBP Customer:BBB:Assets:Receivables + 5.00 GBP Customer:DDD:Assets:Receivables +-------------------- + 28.00 GBP +end test + +test bal assets:receivables --pivot Customer --empty + 28.00 GBP Customer + 12.00 GBP AAA:Assets:Receivables + 11.00 GBP BBB:Assets:Receivables + 0 CCC:Assets:Receivables + 5.00 GBP DDD:Assets:Receivables +-------------------- + 28.00 GBP +end test + +test bal assets:receivables --pivot Customer --empty -p "until 2014-05-05" + 48.00 GBP Customer + 22.00 GBP AAA:Assets:Receivables + 11.00 GBP BBB:Assets:Receivables + 15.00 GBP CCC:Assets:Receivables +-------------------- + 48.00 GBP +end test + +test bal assets:receivables --pivot Customer --empty -p "until 2014-05-06" + 58.00 GBP Customer + 12.00 GBP AAA:Assets:Receivables + 11.00 GBP BBB:Assets:Receivables + 15.00 GBP CCC:Assets:Receivables + 20.00 GBP DDD:Assets:Receivables +-------------------- + 58.00 GBP +end test + diff --git a/test/baseline/opt-price.test b/test/baseline/opt-price.test index 2ebd061e..2a9778cc 100644 --- a/test/baseline/opt-price.test +++ b/test/baseline/opt-price.test @@ -18,7 +18,7 @@ end test test reg -B equities 08-Jan-01 Purchase Apple shares Equities $2000 $2000 -08-Jun-30 Sell some Apple sha.. Equities $-1250 $750 +08-Jun-30 Sell some Apple sha.. Equities $-1000 $1000 end test test reg --end 2009/06/26 -V equities @@ -31,8 +31,9 @@ end test test reg --end 2009/06/26 -G equities 08-Jun-30 Commodities revalued <Revalued> $500 $500 -09-Jan-31 Commodities revalued <Revalued> $250 $750 -09-Jun-26 Commodities revalued <Revalued> $500 $1250 +08-Jun-30 Sell some Apple sha.. Equities $-250 $250 +09-Jan-31 Commodities revalued <Revalued> $250 $500 +09-Jun-26 Commodities revalued <Revalued> $500 $1000 end test test reg -I equities diff --git a/test/baseline/opt-primary-date.test b/test/baseline/opt-primary-date.test index e69de29b..e433a8f9 100644 --- a/test/baseline/opt-primary-date.test +++ b/test/baseline/opt-primary-date.test @@ -0,0 +1,99 @@ +; primary-date display primary dates for all calculations +2014/01/01=2014/01/13 Client invoice ; estimated date you'll be paid + Assets:Accounts Receivable $100.00 + Income: Client ABC + +2014/01/01=2014/01/15 Client invoice ; actual date money received + Assets:Accounts Receivable $100.00 + Income: Client ABC + +; will not affect checking account +2013/10/16 * (2090) Bountiful Blessings Farm + Expenses:Food:Groceries $ 37.50 ; [=2013/10/01] + Expenses:Food:Groceries $ 37.50 ; [=2013/11/01] + Expenses:Food:Groceries $ 37.50 ; [=2013/12/01] + Expenses:Food:Groceries $ 37.50 ; [=2014/01/01] + Expenses:Food:Groceries $ 37.50 ; [=2014/02/01] + Expenses:Food:Groceries $ 37.50 ; [=2014/03/01] + Assets:Checking + + +test bal Income --begin 2014/01/01 --end 2014/01/14 + $ -200.00 Income: Client ABC +end test + +test bal Income --effective --begin 2014/01/01 --end 2014/01/14 + $ -100.00 Income: Client ABC +end test + +test bal Income --primary-date --effective --begin 2014/01/01 --end 2014/01/14 + $ -200.00 Income: Client ABC +end test + +test bal Income --actual-dates --effective --begin 2014/01/01 --end 2014/01/14 + $ -200.00 Income: Client ABC +end test + +test reg Income --begin 2014/01/01 --end 2014/01/14 +14-Jan-01 Client invoice Income: Client ABC $ -100.00 $ -100.00 +14-Jan-01 Client invoice Income: Client ABC $ -100.00 $ -200.00 +end test + +test reg Income --effective --begin 2014/01/01 --end 2014/01/14 +14-Jan-13 Client invoice Income: Client ABC $ -100.00 $ -100.00 +end test + +test reg Income --primary-date --effective --begin 2014/01/01 --end 2014/01/14 +14-Jan-01 Client invoice Income: Client ABC $ -100.00 $ -100.00 +14-Jan-01 Client invoice Income: Client ABC $ -100.00 $ -200.00 +end test + +test reg Income --actual-dates --effective --begin 2014/01/01 --end 2014/01/14 +14-Jan-01 Client invoice Income: Client ABC $ -100.00 $ -100.00 +14-Jan-01 Client invoice Income: Client ABC $ -100.00 $ -200.00 +end test + +test reg checking +13-Oct-16 Bountiful Blessings.. Assets:Checking $ -225.00 $ -225.00 +end test + +test reg checking --primary-date --effective +13-Oct-16 Bountiful Blessings.. Assets:Checking $ -225.00 $ -225.00 +end test + +test register Groceries +13-Oct-16 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 37.50 + Expense:Food:Groceries $ 37.50 $ 75.00 + Expense:Food:Groceries $ 37.50 $ 112.50 + Expense:Food:Groceries $ 37.50 $ 150.00 + Expense:Food:Groceries $ 37.50 $ 187.50 + Expense:Food:Groceries $ 37.50 $ 225.00 +end test + +test register Groceries --effective +13-Oct-01 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 37.50 +13-Nov-01 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 75.00 +13-Dec-01 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 112.50 +14-Jan-01 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 150.00 +14-Feb-01 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 187.50 +14-Mar-01 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 225.00 +end test + +test register Groceries --primary-date --effective +13-Oct-16 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 37.50 + Expense:Food:Groceries $ 37.50 $ 75.00 + Expense:Food:Groceries $ 37.50 $ 112.50 + Expense:Food:Groceries $ 37.50 $ 150.00 + Expense:Food:Groceries $ 37.50 $ 187.50 + Expense:Food:Groceries $ 37.50 $ 225.00 +end test + +test register Groceries --actual-dates --effective +13-Oct-16 Bountiful Blessings.. Expense:Food:Groceries $ 37.50 $ 37.50 + Expense:Food:Groceries $ 37.50 $ 75.00 + Expense:Food:Groceries $ 37.50 $ 112.50 + Expense:Food:Groceries $ 37.50 $ 150.00 + Expense:Food:Groceries $ 37.50 $ 187.50 + Expense:Food:Groceries $ 37.50 $ 225.00 +end test + diff --git a/test/baseline/opt-recursive-aliases.test b/test/baseline/opt-recursive-aliases.test new file mode 100644 index 00000000..d9addcd1 --- /dev/null +++ b/test/baseline/opt-recursive-aliases.test @@ -0,0 +1,12 @@ +alias A=B:A +alias B=C:B +alias C=D:C + +2001-01-01 Test + A 10 EUR + Foo + +test reg --recursive-aliases +01-Jan-01 Test D:C:B:A 10 EUR 10 EUR + Foo -10 EUR 0 +end test diff --git a/test/baseline/opt-register-format.test b/test/baseline/opt-register-format.test index 384accd8..843aa3ca 100644 --- a/test/baseline/opt-register-format.test +++ b/test/baseline/opt-register-format.test @@ -3,6 +3,6 @@ Income:Dividends:Vanguard:VMMXX $-0.35 test reg --register-format='%(amount)\n' -0.350 VMMXX {$1.00} [2007/02/02] +0.350 VMMXX {$1.00} [07-Feb-02] $-0.35 end test diff --git a/test/baseline/opt-rich-data.test b/test/baseline/opt-rich-data.test index e69de29b..fbb73ebe 100644 --- a/test/baseline/opt-rich-data.test +++ b/test/baseline/opt-rich-data.test @@ -0,0 +1,32 @@ +test -f /dev/null convert test/baseline/feat-convert-with-directives.dat --detail --now '2014/08/01' +2012/01/01 * KFC + ; CSV: 2012/01/01,KFC,$10 + ; Imported: 2014/08/01 + ; UUID: 4352cc5a03f882f6f159b90a518667bde7200351 + Expenses:Unknown $10 + Equity:Unknown + +2012/01/02 * REWE SAGT DANKE 123454321 + ; CSV: 2012/01/02,"REWE SAGT DANKE 123454321",10€ + ; Imported: 2014/08/01 + ; UUID: 4d04439fba0c7336377d1191c545efd0cfa15437 + Expenses:Unknown 10€ + Equity:Unknown +end test + +test -f /dev/null convert test/baseline/feat-convert-with-directives.dat --rich-data --date-format %d-%m-%Y --now '2014/08/01' +01-01-2012 * KFC + ; CSV: 2012/01/01,KFC,$10 + ; Imported: 2014/08/01 + ; UUID: 4352cc5a03f882f6f159b90a518667bde7200351 + Expenses:Unknown $10 + Equity:Unknown + +02-01-2012 * REWE SAGT DANKE 123454321 + ; CSV: 2012/01/02,"REWE SAGT DANKE 123454321",10€ + ; Imported: 2014/08/01 + ; UUID: 4d04439fba0c7336377d1191c545efd0cfa15437 + Expenses:Unknown 10€ + Equity:Unknown +end test + diff --git a/test/baseline/opt-tail.test b/test/baseline/opt-tail.test index 4341347c..5c01c71d 100644 --- a/test/baseline/opt-tail.test +++ b/test/baseline/opt-tail.test @@ -202,3 +202,17 @@ test reg --tail=10 books 09-Dec-01 December Expenses:Books $120.00 $3000.00 09-Dec-31 End of December Expenses:Books $120.00 $3120.00 end test + +test reg --last=10 books +09-Aug-01 August Expenses:Books $80.00 $2200.00 +09-Aug-31 End of August Expenses:Books $80.00 $2280.00 +09-Sep-01 September Expenses:Books $90.00 $2370.00 +09-Sep-30 End of September Expenses:Books $90.00 $2460.00 +09-Oct-01 October Expenses:Books $100.00 $2560.00 +09-Oct-31 End of October Expenses:Books $100.00 $2660.00 +09-Nov-01 November Expenses:Books $110.00 $2770.00 +09-Nov-30 End of November Expenses:Books $110.00 $2880.00 +09-Dec-01 December Expenses:Books $120.00 $3000.00 +09-Dec-31 End of December Expenses:Books $120.00 $3120.00 +end test + diff --git a/test/baseline/opt-time-colon.test b/test/baseline/opt-time-colon.test new file mode 100644 index 00000000..74ec7549 --- /dev/null +++ b/test/baseline/opt-time-colon.test @@ -0,0 +1,45 @@ +2013/04/05 () Meeting Tactical + (Internal:Meeting:Tactical) 1800s @ ($36/3600) + +2013/04/05 () Email + (CustomerA:Email) 300s + +2013/04/05 () Config + (CustomerB:Config) 5100s + +2013/04/05 () Walk + (Personal:Walk) 1800s + +2013/04/05 () Lunch + (Personal:Lunch) 5400s + +test bal + 5.0m CustomerA:Email + 1.42h CustomerB:Config + 30.0m Internal:Meeting:Tactical + 2.00h Personal + 1.50h Lunch + 30.0m Walk +-------------------- + 4.00h +end test + +test bal --time-colon + 5:0m CustomerA:Email + 1:25h CustomerB:Config + 30:0m Internal:Meeting:Tactical + 2:00h Personal + 1:30h Lunch + 30:0m Walk +-------------------- + 4:00h +end test + +test reg --time-colon +13-Apr-05 Meeting Tactical (Int:Meeting:Tactical) 30:0m 30:0m +13-Apr-05 Email (CustomerA:Email) 5:0m 35:0m +13-Apr-05 Config (CustomerB:Config) 1:25h 2:00h +13-Apr-05 Walk (Personal:Walk) 30:0m 2:30h +13-Apr-05 Lunch (Personal:Lunch) 1:30h 4:00h +end test + diff --git a/test/baseline/opt-time-report.test b/test/baseline/opt-time-report.test index e69de29b..605e299e 100644 --- a/test/baseline/opt-time-report.test +++ b/test/baseline/opt-time-report.test @@ -0,0 +1,44 @@ +i 2013/04/05 09:30:00 Internal:Meeting:Tactical [Intelligent comment] +o 2013/04/05 10:00:00 +i 2013/04/05 10:00:00 CustomerA:Email +o 2013/04/05 10:05:00 +i 2013/04/05 10:05:00 CustomerB:Config +o 2013/04/05 11:30:00 +i 2013/04/05 11:30:00 Personal:Walk +o 2013/04/05 12:00:00 +i 2013/04/05 12:00:00 Personal:Lunch +o 2013/04/05 13:30:00 + +test bal + 5.0m CustomerA:Email + 1.42h CustomerB:Config + 30.0m Internal:Meeting:Tactical [Intelligent comment] + 2.00h Personal + 1.50h Lunch + 30.0m Walk +-------------------- + 4.00h +end test + +test bal --time-report + 13-Apr-05 10:00:00 13-Apr-05 10:05:00 5.0m CustomerA:Email + 13-Apr-05 10:05:00 13-Apr-05 11:30:00 1.42h CustomerB:Config + 13-Apr-05 09:30:00 13-Apr-05 10:00:00 30.0m Internal:Meeting:Tactical [Intelligent comment] + 2.00h Personal + 13-Apr-05 12:00:00 13-Apr-05 13:30:00 1.50h Lunch + 13-Apr-05 11:30:00 13-Apr-05 12:00:00 30.0m Walk +-------------------------------------------------- + +end test + +test bal --time-report --time-colon + 13-Apr-05 10:00:00 13-Apr-05 10:05:00 5:0m CustomerA:Email + 13-Apr-05 10:05:00 13-Apr-05 11:30:00 1:25h CustomerB:Config + 13-Apr-05 09:30:00 13-Apr-05 10:00:00 30:0m Internal:Meeting:Tactical [Intelligent comment] + 2:00h Personal + 13-Apr-05 12:00:00 13-Apr-05 13:30:00 1:30h Lunch + 13-Apr-05 11:30:00 13-Apr-05 12:00:00 30:0m Walk +-------------------------------------------------- + +end test + diff --git a/test/baseline/opt-trace.test b/test/baseline/opt-trace.test new file mode 100644 index 00000000..9034018e --- /dev/null +++ b/test/baseline/opt-trace.test @@ -0,0 +1,15 @@ +2007/02/02 RD VMMXX + Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 + Income:Dividends:Vanguard:VMMXX $-0.35 + +; Using values with two or more digits as the argument to the --trace option +; resulted in a segmentation fault. +; Since ledger prints debugging information to stderr when the --trace option +; was given and that debugging information contains timing information, e.g. [1ms] +; which is likely to differ on each test run, this test only checks that ledger +; does not crash when the --trace options was specified. +test reg --trace 10 2>/dev/null +07-Feb-02 RD VMMXX As:Inves:Vanguar:VMMXX 0.350 VMMXX 0.350 VMMXX + In:Divid:Vanguar:VMMXX $-0.35 $-0.35 + 0.350 VMMXX +end test diff --git a/test/convert.py b/test/convert.py index ae44b39f..5328c4ae 100755 --- a/test/convert.py +++ b/test/convert.py @@ -3,7 +3,7 @@ # convert.py: This script converts a Boost.Test unit test into an # equivalent Python unit test. # -# Copyright (c) 2003-2010, John Wiegley. All rights reserved. +# Copyright (c) 2003-2015, John Wiegley. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are diff --git a/test/regress/04D86CD0.test b/test/regress/04D86CD0.test new file mode 100644 index 00000000..73d2f887 --- /dev/null +++ b/test/regress/04D86CD0.test @@ -0,0 +1,11 @@ + +; Test for invalid option embedded in journal + +--foo + +test bal -> 1 +__ERROR__ +While parsing file "$FILE", line 4: +Error: Illegal option --foo +end test + diff --git a/test/regress/1036.test b/test/regress/1036.test new file mode 100644 index 00000000..4e639e5b --- /dev/null +++ b/test/regress/1036.test @@ -0,0 +1,80 @@ + +account + +alias + +apply + +assert + +bucket + +check + +commodity + +def + +define + +apply account foo +end + +expr + +eval + +include + +!include + +import + +payee + +tag + +comment +foo bar +end comment + +value + +test source -> 17 +__ERROR__ +While parsing file "$FILE", line 2: +Error: Directive 'account' requires an argument +While parsing file "$FILE", line 4: +Error: Directive 'alias' requires an argument +While parsing file "$FILE", line 6: +Error: Directive 'apply' requires an argument +While parsing file "$FILE", line 8: +Error: Directive 'assert' requires an argument +While parsing file "$FILE", line 10: +Error: Directive 'bucket' requires an argument +While parsing file "$FILE", line 12: +Error: Directive 'check' requires an argument +While parsing file "$FILE", line 14: +Error: Directive 'commodity' requires an argument +While parsing file "$FILE", line 16: +Error: Directive 'def' requires an argument +While parsing file "$FILE", line 18: +Error: Directive 'define' requires an argument +While parsing file "$FILE", line 23: +Error: Directive 'expr' requires an argument +While parsing file "$FILE", line 25: +Error: Directive 'eval' requires an argument +While parsing file "$FILE", line 27: +Error: Directive 'include' requires an argument +While parsing file "$FILE", line 29: +Error: Directive 'include' requires an argument +While parsing file "$FILE", line 31: +Error: Directive 'import' requires an argument +While parsing file "$FILE", line 33: +Error: Directive 'payee' requires an argument +While parsing file "$FILE", line 35: +Error: Directive 'tag' requires an argument +While parsing file "$FILE", line 41: +Error: Directive 'value' requires an argument +end test + diff --git a/test/regress/1038_1.test b/test/regress/1038_1.test new file mode 100644 index 00000000..c833816e --- /dev/null +++ b/test/regress/1038_1.test @@ -0,0 +1,18 @@ +Y2014 + +04/13 Bank + Expenses:Loan $400 + Assets:Cash + +05/13 Bug 1038 Test + Expenses:Some:Account $500 + Assets:Cash + +06/13 Landlord + Expenses:Rent $600 + Assets:Cash + +test reg --now 2014-05-14 -p 'this month' +14-May-13 Bug 1038 Test Expenses:Some:Account $500 $500 + Assets:Cash $-500 0 +end test diff --git a/test/regress/1038_2.test b/test/regress/1038_2.test new file mode 100644 index 00000000..ce0c046d --- /dev/null +++ b/test/regress/1038_2.test @@ -0,0 +1,18 @@ +year 2014 + +04/13 Bank + Expenses:Loan $400 + Assets:Cash + +05/13 Bug 1038 Test + Expenses:Some:Account $500 + Assets:Cash + +06/13 Landlord + Expenses:Rent $600 + Assets:Cash + +test reg --now 2014-05-14 -p 'this month' +14-May-13 Bug 1038 Test Expenses:Some:Account $500 $500 + Assets:Cash $-500 0 +end test diff --git a/test/regress/1038_3.test b/test/regress/1038_3.test new file mode 100644 index 00000000..0e277d71 --- /dev/null +++ b/test/regress/1038_3.test @@ -0,0 +1,20 @@ +apply year 2014 + +04/13 Bank + Expenses:Loan $400 + Assets:Cash + +05/13 Bug 1038 Test + Expenses:Some:Account $500 + Assets:Cash + +06/13 Landlord + Expenses:Rent $600 + Assets:Cash + +end apply + +test reg --now 2014-05-14 -p 'this month' +14-May-13 Bug 1038 Test Expenses:Some:Account $500 $500 + Assets:Cash $-500 0 +end test diff --git a/test/regress/1046.test b/test/regress/1046.test new file mode 100644 index 00000000..60c27783 --- /dev/null +++ b/test/regress/1046.test @@ -0,0 +1,35 @@ + +2014-05-01 * Test 1 + A 1.00 GBP (@) 1.23 EUR + B -1.23 EUR + +2014-05-02 * Test 2 + A 1.00 GBP (@@) 1.23 EUR + B -1.23 EUR + +2014-05-03 * Test 3 + A 1.00 GBP @ 1.23 EUR + B -1.23 EUR + +2014-05-04 * Test 4 + A 1.00 GBP @@ 1.23 EUR + B -1.23 EUR + +test print +2014/05/01 * Test 1 + A 1.00 GBP (@) 1.23 EUR + B -1.23 EUR + +2014/05/02 * Test 2 + A 1.00 GBP (@@) 1.23 EUR + B -1.23 EUR + +2014/05/03 * Test 3 + A 1.00 GBP @ 1.23 EUR + B -1.23 EUR + +2014/05/04 * Test 4 + A 1.00 GBP @@ 1.23 EUR + B -1.23 EUR +end test + diff --git a/test/regress/1050.test b/test/regress/1050.test new file mode 100644 index 00000000..a214e053 --- /dev/null +++ b/test/regress/1050.test @@ -0,0 +1,39 @@ + +D $1000.00 +D £1000.00 +D €1000.00 +D 1000.00 EUR + +2014-06-05 * Test + A 2 EUR @$1.37 + C + +2014-06-05 * Test + A 2 EUR @@£1.62 + C + +2014-06-05 * Test + A 2 EUR (@)€1.00 + C + +2014-06-05 * Test + A 2 EUR (@@)€2.00 + C + +test bal + 8.00 EUR A + $-2.74 + £-1.62 + €-4.00 C +-------------------- + $-2.74 + 8.00 EUR + £-1.62 + €-4.00 +end test + +test pricedb +P 2014/06/05 00:00:00 EUR $1.37 +P 2014/06/05 00:00:00 EUR £0.81 +end test + diff --git a/test/regress/1072.test b/test/regress/1072.test new file mode 100644 index 00000000..3f58b83f --- /dev/null +++ b/test/regress/1072.test @@ -0,0 +1,31 @@ + +--input-date-format %d/%m/%y +--date-format %d/%m/%y + +1/1/14 * Test + A $10 + B + +12/1/14 * Test + A $20 + B + +test --input-date-format %d/%m/%y reg --begin 2/1/13 +01/01/14 Test A $10 $10 + B $-10 0 +12/01/14 Test A $20 $20 + B $-20 0 +end test + +test --input-date-format %d/%m/%y reg --begin 1/1/14 +01/01/14 Test A $10 $10 + B $-10 0 +12/01/14 Test A $20 $20 + B $-20 0 +end test + +test --input-date-format %d/%m/%y reg --begin 2/1/14 +12/01/14 Test A $20 $20 + B $-20 0 +end test + diff --git a/test/regress/1074.test b/test/regress/1074.test new file mode 100644 index 00000000..1aaf0ca0 --- /dev/null +++ b/test/regress/1074.test @@ -0,0 +1,161 @@ + +--input-date-format %Y-%m-%d +--date-format %Y-%m-%d + +2011-06-01 * Jun 2011 + A $10 + B + +2011-07-01 * Jul 2011 + A $10 + B + +2011-08-01 * Aug 2011 + A $10 + B + +2012-06-01 * Jun 2012 + A $10 + B + +2012-07-01 * Jul 2012 + A $10 + B + +2012-08-01 * Aug 2012 + A $10 + B + +2013-06-01 * Jun 2013 + A $10 + B + +2013-07-01 * Jul 2013 + A $10 + B + +2013-08-01 * Aug 2013 + A $10 + B + +2014-06-01 * Jun 2014 + A $10 + B + +2014-07-01 * Jul 2014 + A $10 + B + +2014-08-01 * Aug 2014 + A $10 + B + +2015-06-01 * Jun 2015 + A $10 + B + +2015-07-01 * Jul 2015 + A $10 + B + +2015-08-01 * Aug 2015 + A $10 + B + +test --now 2012-02-03 reg -p "from june to july" +2012-06-01 Jun 2012 A $10 $10 + B $-10 0 +end test + +test --now 2013-02-03 reg -p "from june to july" +2013-06-01 Jun 2013 A $10 $10 + B $-10 0 +end test + +test --now 2014-02-03 reg -p "from june to july" +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2014-10-02 reg -p "from june to july" +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2012-02-03 reg -p "from june to july 2014" +2012-06-01 Jun 2012 A $10 $10 + B $-10 0 +2012-07-01 Jul 2012 A $10 $10 + B $-10 0 +2012-08-01 Aug 2012 A $10 $10 + B $-10 0 +2013-06-01 Jun 2013 A $10 $10 + B $-10 0 +2013-07-01 Jul 2013 A $10 $10 + B $-10 0 +2013-08-01 Aug 2013 A $10 $10 + B $-10 0 +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2013-10-02 reg -p "from june to july 2014" +2013-06-01 Jun 2013 A $10 $10 + B $-10 0 +2013-07-01 Jul 2013 A $10 $10 + B $-10 0 +2013-08-01 Aug 2013 A $10 $10 + B $-10 0 +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2014-01-02 reg -p "from june to july 2014" +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2014-10-02 reg -p "from june to july 2014" +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2012-02-03 reg -p "from june 2012 to july 2014" +2012-06-01 Jun 2012 A $10 $10 + B $-10 0 +2012-07-01 Jul 2012 A $10 $10 + B $-10 0 +2012-08-01 Aug 2012 A $10 $10 + B $-10 0 +2013-06-01 Jun 2013 A $10 $10 + B $-10 0 +2013-07-01 Jul 2013 A $10 $10 + B $-10 0 +2013-08-01 Aug 2013 A $10 $10 + B $-10 0 +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2012-02-03 reg -p "from june 2013 to july 2014" +2013-06-01 Jun 2013 A $10 $10 + B $-10 0 +2013-07-01 Jul 2013 A $10 $10 + B $-10 0 +2013-08-01 Aug 2013 A $10 $10 + B $-10 0 +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2015-02-03 reg -p "from june 2013 to july 2014" +2013-06-01 Jun 2013 A $10 $10 + B $-10 0 +2013-07-01 Jul 2013 A $10 $10 + B $-10 0 +2013-08-01 Aug 2013 A $10 $10 + B $-10 0 +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + diff --git a/test/regress/15A80F68.test b/test/regress/15A80F68.test index 0b29b82d..4eb66fe7 100644 --- a/test/regress/15A80F68.test +++ b/test/regress/15A80F68.test @@ -6,7 +6,7 @@ test bal -> 1 __ERROR__ -While parsing file "$FILE", line 4: +While parsing file "$FILE", line 4: While parsing posting: A (2 FOO @ 10.00 EUR) = 20.00 EUR ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/test/regress/1A546C4D.test b/test/regress/1A546C4D.test index 97adc9de..d6ffb68e 100644 --- a/test/regress/1A546C4D.test +++ b/test/regress/1A546C4D.test @@ -4,7 +4,7 @@ test bal -> 1 __ERROR__ -While parsing file "$FILE", line 2: +While parsing file "$FILE", line 2: While parsing posting: Assets:Cash $1,00.00 ^^^^^^^^ diff --git a/test/regress/2E3496BD.test b/test/regress/2E3496BD.test index 82c7cde7..007bb25f 100644 --- a/test/regress/2E3496BD.test +++ b/test/regress/2E3496BD.test @@ -6,7 +6,7 @@ D 1,000.00 USD test bal -> 1 __ERROR__ -While parsing file "$FILE", line 5: +While parsing file "$FILE", line 5: While balancing transaction from "$FILE", lines 3-5: > 2007-12-31 * Start of year / Opening balances. > Account1 1000 EUR @ 1.6 USD diff --git a/test/regress/375.test b/test/regress/375.test new file mode 100644 index 00000000..84254155 --- /dev/null +++ b/test/regress/375.test @@ -0,0 +1,36 @@ + +2009-01-01 * Jan 09 + Assets:Current 100.00 EUR + Income:Salary + +2009-02-01 * Feb 09 + Assets:Current 100.00 EUR + Income:Salary + +2009-03-01 * Mar 09 + Assets:Current 100.00 EUR + Income:Salary + +2010-01-01 * Jan 10 + Assets:Current 100.00 EUR + Income:Salary + +2010-02-01 * Feb 10 + Assets:Current 100.00 EUR + Income:Salary + +test reg -p "until Feb 2009" +09-Jan-01 Jan 09 Assets:Current 100.00 EUR 100.00 EUR + Income:Salary -100.00 EUR 0 +end test + +test reg -p "until February 2009" +09-Jan-01 Jan 09 Assets:Current 100.00 EUR 100.00 EUR + Income:Salary -100.00 EUR 0 +end test + +test reg -p "in Feb 2009" +09-Feb-01 Feb 09 Assets:Current 100.00 EUR 100.00 EUR + Income:Salary -100.00 EUR 0 +end test + diff --git a/test/regress/383.test b/test/regress/383.test new file mode 100644 index 00000000..ab4372fd --- /dev/null +++ b/test/regress/383.test @@ -0,0 +1,29 @@ + +--input-date-format %Y:%m:%d + +D 1000.00 GBP + +2014:05:12 * Test + Assets:Investments 100 AA {2.00 GBP} [2014:01:01] @@ 200.00 GBP + Equity:Opening balance + +test bal Assets:Investments --lots --date-format %Y.%m.%d +100 AA {2.00 GBP} [2014.01.01] Assets:Investments +end test + +test bal Assets:Investments --lots --date-format %Y/%m/%d +100 AA {2.00 GBP} [2014/01/01] Assets:Investments +end test + +test bal Assets:Investments --lots --date-format %Y:%m:%d +100 AA {2.00 GBP} [2014:01:01] Assets:Investments +end test + +test bal Assets:Investments --lots --date-format %Y-%m-%d +100 AA {2.00 GBP} [2014-01-01] Assets:Investments +end test + +test bal Assets:Investments --lots --date-format %g-%b-%d +100 AA {2.00 GBP} [14-Jan-01] Assets:Investments +end test + diff --git a/test/regress/494-a.ledger b/test/regress/494-a.ledger new file mode 100644 index 00000000..4094f7dc --- /dev/null +++ b/test/regress/494-a.ledger @@ -0,0 +1,10 @@ + +15.03.2006 Exxon + Expenses:Auto:Gas 10,00 € + Liabilities:MasterCard -10,00 € + +test --input-date-format '%d.%m.%Y' reg +06-Mar-15 Exxon Expenses:Auto:Gas 10,00 € 10,00 € + Liabilities:MasterCard -10,00 € 0 +end test + diff --git a/test/regress/494-b.ledger b/test/regress/494-b.ledger new file mode 100644 index 00000000..40e8b1b7 --- /dev/null +++ b/test/regress/494-b.ledger @@ -0,0 +1,17 @@ + +--input-date-format %d.%m + +Y2010 +03.01 * Foo + A 10.00 EUR + B + +05.02 * Bar + A 20.00 EUR + B + +test reg A +10-Jan-03 Foo A 10.00 EUR 10.00 EUR +10-Feb-05 Bar A 20.00 EUR 30.00 EUR +end test + diff --git a/test/regress/5D92A5EB.test b/test/regress/5D92A5EB.test index 1bdd7256..57fcadb3 100644 --- a/test/regress/5D92A5EB.test +++ b/test/regress/5D92A5EB.test @@ -14,7 +14,7 @@ test -J reg checking -> 1 __ERROR__ -While parsing file "$FILE", line 13: +While parsing file "$FILE", line 13: While parsing periodic transaction: > ~ Monthly from 2010/7/1 > Expenses:Auto:Gas $100.00 @@ -29,6 +29,6 @@ While parsing periodic transaction: > Liabilities:Education:ULL $100.00 > Liabilities:Mortgage $100.00 > Assets:Bank:Checking -Error: Posting with null amount's account may be mispelled: +Error: Posting with null amount's account may be misspelled: "Expenses:Entertainment:Blizzard $100.00" end test diff --git a/test/regress/6188B0EC.test b/test/regress/6188B0EC.test index b2aec910..3404fee4 100644 --- a/test/regress/6188B0EC.test +++ b/test/regress/6188B0EC.test @@ -4,7 +4,7 @@ test bal -> 1 __ERROR__ -While parsing file "$FILE", line 3: +While parsing file "$FILE", line 3: Error: File to include was not found: "$sourcepath/test/regress/6188B0EC-does-not-exist.dat" end test diff --git a/test/regress/634AA589.test b/test/regress/634AA589.test new file mode 100644 index 00000000..8f8ff031 --- /dev/null +++ b/test/regress/634AA589.test @@ -0,0 +1,19 @@ + +; The option --permissive quiets balance assertions + +2014-05-01 * Opening balance + Assets:Cash $100 + Equity:Opening balance + +2014-05-10 * Spend money + Expenses:Foo $10 + Assets:Cash -$10 = $80 + +test bal --permissive + $90 Assets:Cash + $-100 Equity:Opening balance + $10 Expenses:Foo +-------------------- + 0 +end test + diff --git a/test/regress/6E7C2DF9.test b/test/regress/6E7C2DF9.test new file mode 100644 index 00000000..c55fbdcc --- /dev/null +++ b/test/regress/6E7C2DF9.test @@ -0,0 +1,24 @@ +Y 2010 +10/10 * TwentyTen + Account:Ten $ 10.10 + Assets:Cash + +apply year 2011 +11/11 * TwentyEleven + Account:Eleven $ 11.11 + Assets:Cash + +2012/12/12 * TwentyTwelve + Account:Twelve $ 12.12 + Assets:Cash + +11/11 * TwentyEleven Again + Account:Eleven $ 11.11 + Assets:Cash + +test reg --sort date account +10-Oct-10 TwentyTen Account:Ten $ 10.10 $ 10.10 +11-Nov-11 TwentyEleven Account:Eleven $ 11.11 $ 21.21 +11-Nov-11 TwentyEleven Again Account:Eleven $ 11.11 $ 32.32 +12-Dec-12 TwentyTwelve Account:Twelve $ 12.12 $ 44.44 +end test diff --git a/test/regress/712.test b/test/regress/712-a.test index e0dbfa5a..e0dbfa5a 100644 --- a/test/regress/712.test +++ b/test/regress/712-a.test diff --git a/test/regress/712-b.test b/test/regress/712-b.test new file mode 100644 index 00000000..7f183b5f --- /dev/null +++ b/test/regress/712-b.test @@ -0,0 +1,22 @@ + +2011-01-01 * Opening balance + Assets:Cash 10.00 GBP + Equity:Opening balance -10.00 GBP + +2011-02-01 * Buy 1 AAA for 10.00 GBP + Assets:Investments 1 AAA {10.00 GBP} + Assets:Cash -10.00 GBP + +2011-12-07 * Sell AAA with a gain + Assets:Cash 12.00 GBP + Assets:Investments -1 AAA {10.00 GBP} @@ 12.00 GBP + Income:Capital gains -2.00 GBP + +test bal + 12.00 GBP Assets:Cash + -10.00 GBP Equity:Opening balance + -2.00 GBP Income:Capital gains +-------------------- + 0 +end test + diff --git a/test/regress/713-a.test b/test/regress/713-a.test new file mode 100644 index 00000000..b3953a84 --- /dev/null +++ b/test/regress/713-a.test @@ -0,0 +1,40 @@ + +2011-01-01 * Opening balance + Assets:Cash 25.00 GBP + Equity:Opening balance -25.00 GBP + +2011-02-01 * Buy 1 AAA for 10.00 GBP + Assets:Investments 1 AAA {10.00 GBP} + Assets:Cash -10.00 GBP + +2011-03-07 * Sell one AAA with a gain + Assets:Cash 12.00 GBP + Assets:Investments -1 AAA {10.00 GBP} @@ 12.00 GBP + Income:Capital gains -2.00 GBP + +2011-04-01 * Buy 1 BBB for 15.00 GBP + Assets:Investments 1 BBB {15.00 GBP} + Assets:Cash -15.00 GBP + +test bal -B Assets:Investments -p "until 2011-02-20" + 10.00 GBP Assets:Investments +end test + +test bal -B Assets:Investments -p "until 2011-03-20" +end test + +test bal -B Assets:Investments -p "until 2011-04-20" + 15.00 GBP Assets:Investments +end test + +test bal Assets:Investments -p "until 2011-02-20" + 1 AAA Assets:Investments +end test + +test bal Assets:Investments -p "until 2011-03-20" +end test + +test bal Assets:Investments -p "until 2011-04-20" + 1 BBB Assets:Investments +end test + diff --git a/test/regress/713-b.test b/test/regress/713-b.test new file mode 100644 index 00000000..36685b27 --- /dev/null +++ b/test/regress/713-b.test @@ -0,0 +1,48 @@ + +2014-01-01 * Opening balances + Assets:Cash 100.00 GBP + Equity:Opening balances + +2014-02-01 * Buy 1 AAA for 10 GBP + Assets:Investments 1 AAA @ 10.00 GBP + Assets:Cash -10.00 GBP + +2014-03-01 * Buy 1 AAA for 20 GBP + Assets:Investments 1 AAA @ 20.00 GBP + Assets:Cash -20.00 GBP + +; Let's say the second purchase attracts an equalisation of 2.00 GBP. +; This means that the purchase price from now on should be 18.00 +; rather than 20.00 GBP. So we add a new share with that price and +; the original date, and remove the existing share at the old price; the +; difference of 2.00 GBP is the equalisation received, which is paid to +; the account. +2014-04-16 * Dividend (Equalisation) from AAA + Assets:Investments 1 AAA {18.00 GBP} [2014-03-01] @@ 18.00 GBP + Assets:Investments -1 AAA {20.00 GBP} [2014-03-01] @@ 20.00 GBP + Assets:Broker 2.00 GBP + +test bal -B Assets:Investment -p "until 2014-02-20" + 10.00 GBP Assets:Investments +end test + +test bal -B Assets:Investment -p "until 2014-03-20" + 30.00 GBP Assets:Investments +end test + +test bal -B Assets:Investment -p "until 2014-04-20" + 28.00 GBP Assets:Investments +end test + +test bal Assets:Investment -p "until 2014-02-20" + 1 AAA Assets:Investments +end test + +test bal Assets:Investment -p "until 2014-03-20" + 2 AAA Assets:Investments +end test + +test bal Assets:Investment -p "until 2014-04-20" + 2 AAA Assets:Investments +end test + diff --git a/test/regress/730.test b/test/regress/730.test new file mode 100644 index 00000000..d81a1c22 --- /dev/null +++ b/test/regress/730.test @@ -0,0 +1,37 @@ +; Using -M in combination with an empty result causes a segmentation fault +; therefore this test case does not have or need any test data + +test -f /dev/null -M reg +end test + +; Tests mentioned in #730 +test reg -M +end test + +test reg -M .foo +end test + +test reg -M -e 2012/01 +end test + + +; Tests mentioned in #1080 +test reg '^Expenses' and expr 'any(account =~ /^Assets:Cash/)' --period 'every week this month' +end test + +test bal '^Expenses' and expr 'any(account =~ /^Assets:Cash/)' --period 'every week this month' +end test + +test bal reg foo and expr 'any(account =~ /bar/)' --period 'every week' +end test + + +; Tests mentioned in #1084 +test b abc -M +end test + +test reg foo -M +end test + +test bal foo -M +end test diff --git a/test/regress/755.test b/test/regress/755.test new file mode 100644 index 00000000..9581debc --- /dev/null +++ b/test/regress/755.test @@ -0,0 +1,90 @@ + +; Test backwards compatibility with ledger2 + +--date-format %Y/%m/%d + +2009-04-17 * Test 1 + A 10.00 EUR + B + +2009-04-18=2010-04-20 (110) Test 2 + * C 20.00 EUR ;foo + * B + +test -F "%a\n" reg +A +B +C +B +end test + +test -F "%A\n" reg +A +B +C +B +end test + +test -F "%d\n" reg +2009/04/17 +2009/04/17 +2009/04/18=2010/04/20 +2009/04/18=2010/04/20 +end test + +test -F "%D\n" reg +2009/04/17 +2009/04/17 +2009/04/18 +2009/04/18 +end test + +test -F "%S\n" reg +$FILE +$FILE +$FILE +$FILE +end test + +test -F "%b\n" reg +7 +8 +11 +12 +end test + +test -F "%B\n" reg +90 +126 +168 +209 +end test + +test -F "%X%P\n" reg +* Test 1 +* Test 1 +* Test 2 +* Test 2 +end test + +test -F "%Y%P\n" reg +* Test 1 +* Test 1 +Test 2 +Test 2 +end test + +test -F "%C%P\n" reg +Test 1 +Test 1 +(110) Test 2 +(110) Test 2 +end test + +test -F "%N\n" reg + + +foo + +end test + diff --git a/test/regress/785.test b/test/regress/785.test new file mode 100644 index 00000000..706d7a84 --- /dev/null +++ b/test/regress/785.test @@ -0,0 +1,85 @@ + +account AA + alias + +account BB + default + +account CC + note + +account DD + payee + +account EE + value + +account FF + assert + +account GG + check + +account HH + eval + +account II + expr + +commodity AAA + alias + +commodity BBB + default + +commodity CCC + nomarket + +commodity DDD + value + +commodity EEE + format + +commodity FFF + note + +payee FOO + alias + uuid fooo + +payee BAR + uuid + +test source -> 14 +__ERROR__ +While parsing file "$FILE", line 3: +Error: Account directive 'alias' requires an argument +While parsing file "$FILE", line 9: +Error: Account directive 'note' requires an argument +While parsing file "$FILE", line 12: +Error: Account directive 'payee' requires an argument +While parsing file "$FILE", line 15: +Error: Account directive 'value' requires an argument +While parsing file "$FILE", line 18: +Error: Account directive 'assert' requires an argument +While parsing file "$FILE", line 21: +Error: Account directive 'check' requires an argument +While parsing file "$FILE", line 24: +Error: Account directive 'eval' requires an argument +While parsing file "$FILE", line 27: +Error: Account directive 'expr' requires an argument +While parsing file "$FILE", line 30: +Error: Commodity directive 'alias' requires an argument +While parsing file "$FILE", line 39: +Error: Commodity directive 'value' requires an argument +While parsing file "$FILE", line 42: +Error: Commodity directive 'format' requires an argument +While parsing file "$FILE", line 45: +Error: Commodity directive 'note' requires an argument +While parsing file "$FILE", line 48: +Error: Payee directive 'alias' requires an argument +While parsing file "$FILE", line 52: +Error: Payee directive 'uuid' requires an argument +end test + diff --git a/test/regress/78AB4B87_py.test b/test/regress/78AB4B87_py.test index 8f847145..cbfe9c6a 100644 --- a/test/regress/78AB4B87_py.test +++ b/test/regress/78AB4B87_py.test @@ -5,7 +5,7 @@ Total is presently: (0.00 EUR) Converted to EUR: (-5.73 EUR) Total is now: (-5.73 EUR) --5.00 EUR {0.8733 GBP} [2012/01/03] +-5.00 EUR {0.8733 GBP} [12-Jan-03] EUR Total is presently: (-5.73 EUR) Converted to EUR: (-5.00 EUR) diff --git a/test/regress/8EAF77C0.test b/test/regress/8EAF77C0.test index f0a2829c..9d63951d 100644 --- a/test/regress/8EAF77C0.test +++ b/test/regress/8EAF77C0.test @@ -12,6 +12,6 @@ test reg -> 1 __ERROR__ -While parsing file "$FILE", line 5: +While parsing file "$FILE", line 5: Error: Unexpected whitespace at beginning of line end test diff --git a/test/regress/9188F587_py.test b/test/regress/9188F587_py.test index 28bb34ff..e431af90 100644 --- a/test/regress/9188F587_py.test +++ b/test/regress/9188F587_py.test @@ -5,7 +5,7 @@ Total is presently: (0.00 EUR) Converted to EUR: (-6.00 EUR) Total is now: (-6.00 EUR) --5.00 EUR {0.8733 GBP} [2012/01/03] +-5.00 EUR {0.8733 GBP} [12-Jan-03] EUR Total is presently: (-6.00 EUR) Converted to EUR: (-5.00 EUR) diff --git a/test/regress/999-a.test b/test/regress/999-a.test new file mode 100644 index 00000000..9865eeed --- /dev/null +++ b/test/regress/999-a.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/test/regress/999-b.test b/test/regress/999-b.test new file mode 100644 index 00000000..f6d19f30 --- /dev/null +++ b/test/regress/999-b.test @@ -0,0 +1,22 @@ + +2014-01-01 * Test + Assets:Cash 10.00 GBP + Equity:Opening balance -10.00 GBP + +2014-02-01 * Exchange rate 1.10 + Assets:Cash -1.00 GBP @ 1.10 EUR + Assets:Cash 1.10 EUR + +2014-03-01 * Exchange rate 1.20 + Assets:Cash -1.00 GBP (@) 1.20 EUR + Assets:Cash 1.20 EUR + +test pricedb +P 2014/02/01 00:00:00 GBP 1.10 EUR +end test + +test reg Equity:Opening -X EUR +14-Jan-01 Test Equity:Opening balance -10.00 GBP -10.00 GBP +14-Feb-01 Commodities revalued <Revalued> 0 -11.00 EUR +end test + diff --git a/test/regress/A013A73B.test b/test/regress/A013A73B.test new file mode 100644 index 00000000..251277ea --- /dev/null +++ b/test/regress/A013A73B.test @@ -0,0 +1,10 @@ + +2014-01-01 c ; x + a 1 + b + +test reg +14-Jan-01 c a 1 1 + b -1 0 +end test + diff --git a/test/regress/AA2FF2B.test b/test/regress/AA2FF2B.test new file mode 100644 index 00000000..944cdfea --- /dev/null +++ b/test/regress/AA2FF2B.test @@ -0,0 +1,10 @@ +2008/01/20 * La Poste + Revenu:Invest:Exonéré + Actif:Courant:LaPosteLivretA 25,24 € = 25,24 € + +test --args-only --decimal-comma bal + 25,24 € Actif:Courant:LaPosteLivretA + -25,24 € Revenu:Invest:Exonéré +-------------------- + 0 +end test diff --git a/test/regress/BF3C1F82-2.test b/test/regress/BF3C1F82-2.test index 453151ce..94d59e4d 100644 --- a/test/regress/BF3C1F82-2.test +++ b/test/regress/BF3C1F82-2.test @@ -2,11 +2,11 @@ include non-existent-ledger-file-BF3C1F82 test -f - reg -> 1 __ERROR__ -While parsing file "", line 2: +While parsing file "", line 2: Error: File to include was not found: "./non-existent-ledger-file-BF3C1F82" end test test -f /dev/stdin reg -> 1 __ERROR__ -While parsing file "", line 2: +While parsing file "", line 2: Error: File to include was not found: "./non-existent-ledger-file-BF3C1F82" end test diff --git a/test/regress/BF3C1F82.test b/test/regress/BF3C1F82.test index 50f4106f..9d4937bb 100644 --- a/test/regress/BF3C1F82.test +++ b/test/regress/BF3C1F82.test @@ -5,14 +5,14 @@ b test -f - reg -> 1 __ERROR__ -While parsing file "", line 3: +While parsing file "", line 3: While parsing transaction: <no source context> Error: Day of month is not valid for year end test test -f /dev/stdin reg -> 1 __ERROR__ -While parsing file "", line 3: +While parsing file "", line 3: While parsing transaction: <no source context> Error: Day of month is not valid for year diff --git a/test/regress/C0212EAC.test b/test/regress/C0212EAC.test index 9a572ef6..e77107d7 100644 --- a/test/regress/C0212EAC.test +++ b/test/regress/C0212EAC.test @@ -27,7 +27,4 @@ test reg -5.00 GBP {=1.40 EUR} Income:Gain -0.50 EUR 5.00 GBP -5.00 GBP {=1.40 EUR} - Equity:Capital Gains 0.50 EUR 0.50 EUR - 5.00 GBP - -5.00 GBP {=1.40 EUR} end test diff --git a/test/regress/C19E4E9B.test b/test/regress/C19E4E9B.test index 4837b4cd..822e3f0e 100644 --- a/test/regress/C19E4E9B.test +++ b/test/regress/C19E4E9B.test @@ -6,7 +6,7 @@ A 1 AAA @ 2.00 EUR B -2.00 EUR -test reg --format "%S: %d %P %t %T\n" +test reg --format "%S: %D %P %t %T\n" $FILE: 2012/01/01 Buy AAA 1 AAA 1 AAA $FILE: 2012/01/01 Buy AAA -1.00 EUR 1 AAA -1.00 EUR diff --git a/test/regress/CAE63F5C-b.test b/test/regress/CAE63F5C-b.test index c0b7efd8..e1ea049e 100644 --- a/test/regress/CAE63F5C-b.test +++ b/test/regress/CAE63F5C-b.test @@ -7,9 +7,8 @@ test bal -X $ $272.67 Accrued $-271.54 Assets - $6.45 Equity:Capital Gains $5.32 Expenses $-6.45 Income:Currency Conversion -------------------- - $6.45 + 0 end test diff --git a/test/regress/CAE63F5C-c.test b/test/regress/CAE63F5C-c.test index 64728544..db318b2d 100644 --- a/test/regress/CAE63F5C-c.test +++ b/test/regress/CAE63F5C-c.test @@ -7,9 +7,8 @@ test bal -X $ $272.67 Accrued $-271.54 Assets - $6.45 Equity:Capital Gains $5.32 Expenses $-6.45 Income:Currency Conversion -------------------- - $6.46 + 0 end test diff --git a/test/regress/D51BFF74.test b/test/regress/D51BFF74.test index a13af897..08ed7a8e 100644 --- a/test/regress/D51BFF74.test +++ b/test/regress/D51BFF74.test @@ -16,7 +16,7 @@ test reg -> 1 __ERROR__ -While parsing file "$FILE", line 6: +While parsing file "$FILE", line 6: While parsing posting: Expenses:Food $- 20 ^^^^^ diff --git a/test/regress/D9C8EB08.test b/test/regress/D9C8EB08.test index fa02431b..eb4952ba 100644 --- a/test/regress/D9C8EB08.test +++ b/test/regress/D9C8EB08.test @@ -10,7 +10,7 @@ test bal -> 1 __ERROR__ -While parsing file "$FILE", line 9: +While parsing file "$FILE", line 9: Error: 'end' or 'end apply' found, but no enclosing 'apply' directive end test diff --git a/test/regress/DDB54BB8.test b/test/regress/DDB54BB8.test index 7d72043c..29b32151 100644 --- a/test/regress/DDB54BB8.test +++ b/test/regress/DDB54BB8.test @@ -4,7 +4,7 @@ test bal -> 1 __ERROR__ -While parsing file "$FILE", line 3: +While parsing file "$FILE", line 3: Unbalanced remainder is: -0,10€ Amount to balance against: diff --git a/test/regress/DE17CCF1.test b/test/regress/DE17CCF1.test new file mode 100644 index 00000000..00d4184b --- /dev/null +++ b/test/regress/DE17CCF1.test @@ -0,0 +1,61 @@ + +--date-format %Y-%m-%d + +2014-06-30 Uncleared + U:U 10.00 EUR + ! U:P 10.00 EUR + * U:C 10.00 EUR + Equity -30.00 EUR + +2014-06-30 ! Pending + P:U 10.00 EUR + ! P:P 10.00 EUR + * P:C 10.00 EUR + Equity -30.00 EUR + +2014-06-30 * Cleared + C:C 10.00 EUR + ! C:P 10.00 EUR + * C:P 10.00 EUR + Equity -30.00 EUR + +test reg u: --uncleared +2014-06-30 Uncleared U:U 10.00 EUR 10.00 EUR + U:P 10.00 EUR 20.00 EUR +end test + +test reg u: --pending +2014-06-30 Uncleared U:P 10.00 EUR 10.00 EUR +end test + +test reg u: --cleared +2014-06-30 Uncleared U:C 10.00 EUR 10.00 EUR +end test + +test reg p: --uncleared +2014-06-30 Pending P:U 10.00 EUR 10.00 EUR + P:P 10.00 EUR 20.00 EUR +end test + +test reg p: --pending +2014-06-30 Pending P:U 10.00 EUR 10.00 EUR + P:P 10.00 EUR 20.00 EUR +end test + +test reg p: --cleared +2014-06-30 Pending P:C 10.00 EUR 10.00 EUR +end test + +test reg c: --uncleared +2014-06-30 Cleared C:P 10.00 EUR 10.00 EUR +end test + +test reg c: --pending +2014-06-30 Cleared C:P 10.00 EUR 10.00 EUR +end test + +test reg c: --cleared +2014-06-30 Cleared C:C 10.00 EUR 10.00 EUR + C:P 10.00 EUR 20.00 EUR +end test + diff --git a/test/regress/error-in-include.dat b/test/regress/error-in-include.dat new file mode 100644 index 00000000..9f654a42 --- /dev/null +++ b/test/regress/error-in-include.dat @@ -0,0 +1,5 @@ + +2014-05-13 * Does not balance + A $10.00 + B -$11.00 + diff --git a/test/regress/error-in-include.test b/test/regress/error-in-include.test new file mode 100644 index 00000000..10d8d1da --- /dev/null +++ b/test/regress/error-in-include.test @@ -0,0 +1,17 @@ + +!include error-in-include.dat + +test bal -> 1 +__ERROR__ +In file included from "$FILE", line 2: +While parsing file "$sourcepath/test/regress/error-in-include.dat", line 4: +While balancing transaction from "$sourcepath/test/regress/error-in-include.dat", lines 2-4: +> 2014-05-13 * Does not balance +> A $10.00 +> B -$11.00 +Unbalanced remainder is: + $-1.00 +Amount to balance against: + $10.00 +Error: Transaction does not balance +end test diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 5ecd5a87..8d13d2d6 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -1,15 +1,15 @@ macro(add_ledger_test _name) - add_ledger_library_dependencies(${_name}) + target_link_libraries(${_name} libledger) add_test(Ledger${_name} ${PROJECT_BINARY_DIR}/${_name}) endmacro(add_ledger_test _name) include_directories(${PROJECT_SOURCE_DIR}/src) -if(BUILD_LIBRARY) +if (BUILD_LIBRARY) add_executable(UtilTests t_times.cc) add_ledger_test(UtilTests) - add_executable(MathTests t_amount.cc t_commodity.cc t_balance.cc t_expr.cc) + add_executable(MathTests t_amount.cc t_commodity.cc t_balance.cc t_expr.cc t_value.cc) add_ledger_test(MathTests) set_target_properties(check PROPERTIES DEPENDS LedgerUtilTests) diff --git a/test/unit/t_balance.cc b/test/unit/t_balance.cc index 0d681a88..c4ec2f31 100644 --- a/test/unit/t_balance.cc +++ b/test/unit/t_balance.cc @@ -28,6 +28,498 @@ struct balance_fixture { } }; -//BOOST_FIXTURE_TEST_SUITE(balance, balance_fixture) +BOOST_FIXTURE_TEST_SUITE(balance, balance_fixture) -//BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_CASE(testConstructors) +{ + balance_t b0; + balance_t b1(1.00); + balance_t b2(123456UL); + balance_t b3(12345L); + balance_t b4(string ("EUR 123")); + balance_t b5("$ 456"); + balance_t b6; + balance_t b7(amount_t("$ 1.00")); + balance_t b8(b7); + + BOOST_CHECK_EQUAL(balance_t(), b0); + BOOST_CHECK_NE(balance_t("0"), b0); + BOOST_CHECK_NE(balance_t("0.0"), b0); + BOOST_CHECK_EQUAL(b2, 123456UL); + BOOST_CHECK_EQUAL(b3, 12345L); + BOOST_CHECK_EQUAL(b4, "EUR 123"); + BOOST_CHECK_EQUAL(b5, string("$ 456")); + BOOST_CHECK_EQUAL(b7, b8); + BOOST_CHECK_EQUAL(b8, amount_t("$ 1.00")); + + b5 = "euro 2345"; + b6 = string("DM -34532"); + b7 = amount_t("$ 1.00"); + + b8 = b5; + BOOST_CHECK_EQUAL(b5, b8); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); + BOOST_CHECK(b2.valid()); + BOOST_CHECK(b3.valid()); + BOOST_CHECK(b4.valid()); + BOOST_CHECK(b5.valid()); + BOOST_CHECK(b6.valid()); + BOOST_CHECK(b7.valid()); + BOOST_CHECK(b8.valid()); +} + +BOOST_AUTO_TEST_CASE(testAddition) +{ + amount_t a0; + amount_t a1("$1"); + amount_t a2("2 EUR"); + amount_t a3("0.00 CAD"); + amount_t a4("$2"); + + balance_t b0; + balance_t b1(1.00); + balance_t b2(2UL); + balance_t b3(2L); + balance_t b4; + balance_t b5; + + b0 += b1; + b2 += b3; + b3 += a1; + b3 += a2; + b4 += b3; + b5 += a1; + b5 += a4; + + BOOST_CHECK_EQUAL(balance_t(1.00), b0); + BOOST_CHECK_EQUAL(b3 += a3, b4); + BOOST_CHECK_EQUAL(balance_t(4L), b2); + BOOST_CHECK_EQUAL(balance_t() += amount_t("$3"), b5); + + BOOST_CHECK_THROW(b3 += a0, balance_error); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); + BOOST_CHECK(b2.valid()); + BOOST_CHECK(b3.valid()); + BOOST_CHECK(b4.valid()); + BOOST_CHECK(b5.valid()); +} + +BOOST_AUTO_TEST_CASE(testSubtraction) +{ + amount_t a0; + amount_t a1("$1"); + amount_t a2("2 EUR"); + amount_t a3("0.00 CAD"); + amount_t a4("$2"); + + balance_t b0; + balance_t b1(1.00); + balance_t b2(2UL); + balance_t b3(2L); + balance_t b4; + balance_t b5; + + b0 -= b1; + b2 -= b3; + b3 -= a1; + b3 -= a2; + b4 = b3; + b5 -= a1; + b5 -= a4; + + BOOST_CHECK_EQUAL(balance_t(-1.00), b0); + BOOST_CHECK_EQUAL(b3 -= a3, b4); + BOOST_CHECK_EQUAL(balance_t(), b2); + BOOST_CHECK_EQUAL(b3 -= b2, b3); + BOOST_CHECK_EQUAL(balance_t() -= amount_t("$3"), b5); + + BOOST_CHECK_THROW(b3 -= a0, balance_error); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); + BOOST_CHECK(b2.valid()); + BOOST_CHECK(b3.valid()); + BOOST_CHECK(b4.valid()); + BOOST_CHECK(b5.valid()); +} + +BOOST_AUTO_TEST_CASE(testEqaulity) +{ + amount_t a0; + amount_t a1("$1"); + amount_t a2("2 EUR"); + amount_t a3("0.00 CAD"); + + balance_t b0; + balance_t b1(1.00); + balance_t b2(2UL); + balance_t b3(2L); + balance_t b4("EUR 2"); + balance_t b5("$-1"); + balance_t b6("0.00"); + balance_t b7("0.00"); + + + BOOST_CHECK(b2 == b3); + BOOST_CHECK(b4 == a2); + BOOST_CHECK(b1 == "1.00"); + BOOST_CHECK(b5 == amount_t("-$1")); + BOOST_CHECK(!(b6 == "0")); + BOOST_CHECK(!(b6 == a3)); + BOOST_CHECK(!(b6 == "0.00")); + BOOST_CHECK(b6 == b7); + + b4 += b5; + b5 += a2; + + BOOST_CHECK(b4 == b5); + + BOOST_CHECK_THROW(b0 == a0, balance_error); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); + BOOST_CHECK(b2.valid()); + BOOST_CHECK(b3.valid()); + BOOST_CHECK(b4.valid()); + BOOST_CHECK(b5.valid()); + BOOST_CHECK(b6.valid()); + BOOST_CHECK(b7.valid()); +} + +BOOST_AUTO_TEST_CASE(testMultiplication) +{ + amount_t a0; + amount_t a1("0.00"); + + balance_t b0; + balance_t b1(1.00); + balance_t b2(2UL); + balance_t b3("CAD -3"); + balance_t b4("EUR 4.99999"); + balance_t b5("$1"); + balance_t b6; + + BOOST_CHECK_EQUAL(b1 *= 2.00, amount_t(2.00)); + BOOST_CHECK_EQUAL(b2 *= 2L, amount_t(4L)); + BOOST_CHECK_EQUAL(b2 *= 2UL, amount_t(8UL)); + BOOST_CHECK_EQUAL(b3 *= amount_t("-8 CAD"), amount_t("CAD 24")); + BOOST_CHECK_EQUAL(b0 *= 2UL, b0); + BOOST_CHECK_EQUAL(b0 *= a1, a1); + + b6 += b3; + b3 += b4; + b3 += b5; + b3 *= 2L; + b6 *= 2L; + b4 *= 2L; + b5 *= 2L; + b6 += b4; + b6 += b5; + + BOOST_CHECK_EQUAL(b3, b6); + + BOOST_CHECK_THROW(b1 *= a0 , balance_error); + BOOST_CHECK_THROW(b4 *= amount_t("1 CAD") , balance_error); + BOOST_CHECK_THROW(b3 *= amount_t("1 CAD") , balance_error); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); + BOOST_CHECK(b2.valid()); + BOOST_CHECK(b3.valid()); + BOOST_CHECK(b4.valid()); + BOOST_CHECK(b5.valid()); + BOOST_CHECK(b6.valid()); +} + +BOOST_AUTO_TEST_CASE(testDivision) +{ + amount_t a0; + amount_t a1("0.00"); + + balance_t b0; + balance_t b1(4.00); + balance_t b2(4UL); + balance_t b3("CAD -24"); + balance_t b4("EUR 4"); + balance_t b5("$2"); + balance_t b6; + + BOOST_CHECK_EQUAL(b1 /= 2.00, amount_t(2.00)); + BOOST_CHECK_EQUAL(b2 /= 2L, amount_t(2L)); + BOOST_CHECK_EQUAL(b2 /= 2UL, amount_t(1UL)); + BOOST_CHECK_EQUAL(b3 /= amount_t("-3 CAD"), amount_t("CAD 8")); + BOOST_CHECK_EQUAL(b0 /= 2UL, b0); + + b6 += b3; + b3 += b4; + b3 += b5; + b3 /= 2L; + b6 /= 2L; + b4 /= 2L; + b5 /= 2L; + b6 += b4; + b6 += b5; + + BOOST_CHECK_EQUAL(b3, b6); + + BOOST_CHECK_THROW(b1 /= a0 , balance_error); + BOOST_CHECK_THROW(b1 /= a1 , balance_error); + BOOST_CHECK_THROW(b4 /= amount_t("1 CAD") , balance_error); + BOOST_CHECK_THROW(b3 /= amount_t("1 CAD") , balance_error); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); + BOOST_CHECK(b2.valid()); + BOOST_CHECK(b3.valid()); + BOOST_CHECK(b4.valid()); + BOOST_CHECK(b5.valid()); + BOOST_CHECK(b6.valid()); +} + +BOOST_AUTO_TEST_CASE(testNegation) +{ + amount_t a1("0.00"); + amount_t a2("$ 123"); + amount_t a3("EUR 456"); + + balance_t b0; + balance_t b1; + balance_t b2; + balance_t b3; + + b1 += a1; + b1 += a2; + b1 += a3; + b2 += -a1; + b2 += -a2; + b2 += -a3; + b3 = -b1; + + BOOST_CHECK_EQUAL(b0.negated(), b0); + BOOST_CHECK_EQUAL(b2, b3); + BOOST_CHECK_EQUAL(b2, -b1); + BOOST_CHECK_EQUAL(b2.negated(), b1); + + b2.in_place_negate(); + + BOOST_CHECK_EQUAL(b2, b1); + BOOST_CHECK_EQUAL(b1, -b3); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); + BOOST_CHECK(b2.valid()); + BOOST_CHECK(b3.valid()); +} + +BOOST_AUTO_TEST_CASE(testAbs) +{ + amount_t a1("0.00"); + amount_t a2("$ 123"); + amount_t a3("EUR 456"); + + balance_t b0; + balance_t b1; + balance_t b2; + + b1 += a1; + b1 += a2; + b1 += a3; + b2 += -a1; + b2 += -a2; + b2 += -a3; + + BOOST_CHECK_EQUAL(b0.abs(), b0); + BOOST_CHECK_EQUAL(b2.abs(), b1.abs()); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); + BOOST_CHECK(b2.valid()); +} + +BOOST_AUTO_TEST_CASE(testCeiling) +{ + amount_t a1("0.00"); + amount_t a2("$ 123.123"); + amount_t a3("EUR 456.56"); + amount_t a4(-a1); + amount_t a5(-a2); + amount_t a6(-a3); + + balance_t b0; + balance_t b1; + balance_t b2; + balance_t b3; + balance_t b4; + + b1 += a1; + b1 += a2; + b1 += a3; + b2 += -a1; + b2 += -a2; + b2 += -a3; + + b3 += a1.ceilinged(); + b3 += a2.ceilinged(); + b3 += a3.ceilinged(); + b4 += a4.ceilinged(); + b4 += a5.ceilinged(); + b4 += a6.ceilinged(); + + BOOST_CHECK_EQUAL(b0.ceilinged(), b0); + BOOST_CHECK_EQUAL(b2.ceilinged(), b4); + BOOST_CHECK_EQUAL(b1.ceilinged(), b3); + + b1.in_place_ceiling(); + BOOST_CHECK_EQUAL(b1, b3); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); + BOOST_CHECK(b2.valid()); + BOOST_CHECK(b3.valid()); + BOOST_CHECK(b4.valid()); +} + +BOOST_AUTO_TEST_CASE(testFloor) +{ + amount_t a1("0.00"); + amount_t a2("$ 123.123"); + amount_t a3("EUR 456.56"); + amount_t a4(-a1); + amount_t a5(-a2); + amount_t a6(-a3); + + balance_t b0; + balance_t b1; + balance_t b2; + balance_t b3; + balance_t b4; + + b1 += a1; + b1 += a2; + b1 += a3; + b2 += -a1; + b2 += -a2; + b2 += -a3; + + b3 += a1.floored(); + b3 += a2.floored(); + b3 += a3.floored(); + b4 += a4.floored(); + b4 += a5.floored(); + b4 += a6.floored(); + + BOOST_CHECK_EQUAL(b0.floored(), b0); + BOOST_CHECK_EQUAL(b2.floored(), b4); + BOOST_CHECK_EQUAL(b1.floored(), b3); + + b1.in_place_floor(); + BOOST_CHECK_EQUAL(b1, b3); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); + BOOST_CHECK(b2.valid()); + BOOST_CHECK(b3.valid()); + BOOST_CHECK(b4.valid()); +} + +BOOST_AUTO_TEST_CASE(testRound) +{ + amount_t a1("0.00"); + amount_t a2("$ 123.123"); + amount_t a3("EUR 456.567"); + amount_t a4("0.00"); + amount_t a5("$ 123.12"); + amount_t a6("EUR 456.57"); + + balance_t b0; + balance_t b1; + balance_t b2; + balance_t b3; + balance_t b4; + + b1 += a1; + b1 += a2; + b1 += a3; + b2 += a4; + b2 += a5; + b2 += a6; + + a1.in_place_roundto(2); + a2.in_place_roundto(2); + a3.in_place_roundto(2); + a4.in_place_roundto(2); + a5.in_place_roundto(2); + a6.in_place_roundto(2); + + b3 += a1; + b3 += a2; + b3 += a3; + b4 += a4; + b4 += a5; + b4 += a6; + + BOOST_CHECK_EQUAL(b0.rounded(), b0); + BOOST_CHECK_EQUAL(b2.rounded(), b4); + BOOST_CHECK_EQUAL(b1.rounded(), b4); + + b1.in_place_round(); + BOOST_CHECK_EQUAL(b1, b3); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); + BOOST_CHECK(b2.valid()); + BOOST_CHECK(b3.valid()); + BOOST_CHECK(b4.valid()); +} + +BOOST_AUTO_TEST_CASE(testTruth) +{ + amount_t a1("0.00"); + amount_t a2("$ 123"); + amount_t a3("EUR 456"); + + balance_t b0; + balance_t b1; + + b1 += a1; + b1 += a2; + b1 += a3; + + BOOST_CHECK(!b0); + BOOST_CHECK(b1); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); +} + +BOOST_AUTO_TEST_CASE(testForZero) +{ + amount_t a1("0.00"); + amount_t a2("$ 123"); + amount_t a3("EUR 456"); + + balance_t b0; + balance_t b1; + + b1 += a1; + b1 += a2; + b1 += a3; + + BOOST_CHECK(b0.is_empty()); + BOOST_CHECK(b0.is_zero()); + BOOST_CHECK(b0.is_realzero()); + BOOST_CHECK(!b0.is_nonzero()); + BOOST_CHECK(!b1.is_empty()); + BOOST_CHECK(!b1.is_zero()); + BOOST_CHECK(!b1.is_realzero()); + BOOST_CHECK(b1.is_nonzero()); + + BOOST_CHECK(b0.valid()); + BOOST_CHECK(b1.valid()); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/test/unit/t_value.cc b/test/unit/t_value.cc new file mode 100644 index 00000000..e8367bbe --- /dev/null +++ b/test/unit/t_value.cc @@ -0,0 +1,714 @@ +#define BOOST_TEST_DYN_LINK + +#include <boost/test/unit_test.hpp> + +#include <system.hh> + +#include "value.h" + +using namespace ledger; + +struct value_fixture { + value_fixture() { + times_initialize(); + amount_t::initialize(); + value_t::initialize(); + + + // Cause the display precision for dollars to be initialized to 2. + amount_t x1("$1.00"); + BOOST_CHECK(x1); + + amount_t::stream_fullstrings = true; // make reports from UnitTests accurate + } + + ~value_fixture() + { + amount_t::stream_fullstrings = false; + amount_t::shutdown(); + times_shutdown(); + value_t::shutdown(); + } +}; + +BOOST_FIXTURE_TEST_SUITE(value, value_fixture) + +BOOST_AUTO_TEST_CASE(testConstructors) +{ + value_t::sequence_t s1; + value_t v1; + value_t v2(true); + value_t v3(boost::posix_time::from_time_t(time_t(NULL))); + value_t v4(date_t(parse_date("2014/08/14"))); + value_t v5(2L); + value_t v6(4UL); + value_t v7(1.00); + value_t v8(amount_t("4 GBP")); + value_t v9(balance_t("3 EUR")); + value_t v10(mask_t("regex")); + value_t v11(s1); + value_t v12(string("$1")); + value_t v13("2 CAD"); + value_t v14("comment", true); + value_t v15(string("tag"), true); + + BOOST_CHECK(v1.valid()); + BOOST_CHECK(v2.valid()); + BOOST_CHECK(v3.valid()); + BOOST_CHECK(v4.valid()); + BOOST_CHECK(v5.valid()); + BOOST_CHECK(v6.valid()); + BOOST_CHECK(v7.valid()); + BOOST_CHECK(v8.valid()); + BOOST_CHECK(v9.valid()); + BOOST_CHECK(v10.valid()); + BOOST_CHECK(v11.valid()); + BOOST_CHECK(v12.valid()); + BOOST_CHECK(v13.valid()); + BOOST_CHECK(v14.valid()); + BOOST_CHECK(v15.valid()); +} + +BOOST_AUTO_TEST_CASE(testAssignment) +{ + value_t::sequence_t s1; + value_t v1; + value_t v2 = true; + value_t v3 = boost::posix_time::from_time_t(time_t(NULL)); + value_t v4 = date_t(parse_date("2014/08/14")); + value_t v5 = -2L; + value_t v6 = 4UL; + value_t v7 = 1.00; + value_t v8 = amount_t("4 GBP"); + value_t v9 = balance_t("3 EUR"); + value_t v10 = mask_t("regex"); + value_t v11 = s1; + value_t v12 = value_t(string("$1")); + value_t v13 = value_t("2 CAD"); + value_t v14 = value_t("comment", true); + value_t v15 = value_t(string("tag"), true); + + BOOST_CHECK(v1.valid()); + BOOST_CHECK(v2.valid()); + BOOST_CHECK(v3.valid()); + BOOST_CHECK(v4.valid()); + BOOST_CHECK(v5.valid()); + BOOST_CHECK(v6.valid()); + BOOST_CHECK(v7.valid()); + BOOST_CHECK(v8.valid()); + BOOST_CHECK(v9.valid()); + BOOST_CHECK(v10.valid()); + BOOST_CHECK(v11.valid()); + BOOST_CHECK(v12.valid()); + BOOST_CHECK(v13.valid()); + BOOST_CHECK(v14.valid()); + BOOST_CHECK(v15.valid()); +} + +BOOST_AUTO_TEST_CASE(testEquality) +{ + struct tm localtime; + strptime("10 February 2010", "%d %b %Y", &localtime); + time_t time_var = mktime(&localtime); + value_t::sequence_t s1; + + value_t v1; + value_t v2(true); + value_t v3(boost::posix_time::from_time_t(time_var)); + value_t v4(date_t(parse_date("2014/08/14"))); + value_t v5(2L); + value_t v6(2UL); + value_t v7(1.00); + value_t v8(amount_t("4 GBP")); + value_t v9(balance_t("4 GBP")); + value_t v10(mask_t("regex")); + value_t v11(s1); + value_t v12(string("$1")); + value_t v13("2 CAD"); + value_t v14("comment", true); + value_t v15(string("comment"), true); + value_t v16; + + BOOST_CHECK_EQUAL(v1, value_t()); + BOOST_CHECK_EQUAL(v2, value_t(true)); + BOOST_CHECK_EQUAL(v3, value_t(boost::posix_time::from_time_t(time_var))); + BOOST_CHECK(!(v4 == value_t(date_t(parse_date("2014/08/15"))))); + + value_t v19(amount_t("2")); + value_t v20(balance_t("2")); + BOOST_CHECK_EQUAL(v5, v6); + BOOST_CHECK_EQUAL(v5, v19); + BOOST_CHECK_EQUAL(v5, v20); + BOOST_CHECK(v19 == v5); + BOOST_CHECK(v19 == v20); + BOOST_CHECK(v19 == value_t(amount_t("2"))); + BOOST_CHECK(v20 == v5); + BOOST_CHECK(v20 == v19); + BOOST_CHECK(v20 == value_t(balance_t(2L))); + BOOST_CHECK(v14 == v15); + BOOST_CHECK(v10 == value_t(mask_t("regex"))); + BOOST_CHECK(v11 == value_t(s1)); + + BOOST_CHECK_THROW(v8 == v10, value_error); + + BOOST_CHECK(v1.valid()); + BOOST_CHECK(v2.valid()); + BOOST_CHECK(v3.valid()); + BOOST_CHECK(v4.valid()); + BOOST_CHECK(v5.valid()); + BOOST_CHECK(v6.valid()); + BOOST_CHECK(v7.valid()); + BOOST_CHECK(v8.valid()); + BOOST_CHECK(v9.valid()); + BOOST_CHECK(v10.valid()); + BOOST_CHECK(v11.valid()); + BOOST_CHECK(v12.valid()); + BOOST_CHECK(v13.valid()); + BOOST_CHECK(v14.valid()); + BOOST_CHECK(v15.valid()); + BOOST_CHECK(v19.valid()); + BOOST_CHECK(v20.valid()); +} + +BOOST_AUTO_TEST_CASE(testSequence) +{ + value_t::sequence_t s1; + value_t v1(s1); + BOOST_CHECK(v1.is_sequence()); + v1.push_back(value_t(2L)); + v1.push_back(value_t("3 GBP")); + + value_t v2("3 GBP"); + value_t seq(v1); + const value_t v3(seq); + + value_t::sequence_t::iterator i = std::find(seq.begin(), seq.end(), v2); + if (i != seq.end()) + BOOST_CHECK(v2 == *i); + + value_t::sequence_t::const_iterator j = std::find(v3.begin(), v3.end(), v2); + if (j != v3.end()) + BOOST_CHECK(v2 == *j); + + BOOST_CHECK(v2 == seq[1]); + BOOST_CHECK(v2 == v3[1]); + v1.pop_back(); + v1.pop_back(); + v1.push_front(v2); + v1.push_front(value_t(2L)); + BOOST_CHECK(v2 == v1[1]); + BOOST_CHECK(seq == v1); + + BOOST_CHECK(v1.valid()); + BOOST_CHECK(v2.valid()); + BOOST_CHECK(v3.valid()); + BOOST_CHECK(seq.valid()); +} + +BOOST_AUTO_TEST_CASE(testAddition) +{ + struct tm localtime; + strptime("10 February 2010 00:00:00", "%d %b %Y %H:%M:%S", &localtime); + time_t time_var = mktime(&localtime); + value_t::sequence_t s1; + + value_t v1; + value_t v2(true); + value_t v3(boost::posix_time::from_time_t(time_var)); + value_t v4(date_t(parse_date("2014/08/14"))); + value_t v5(2L); + value_t v6(2UL); + value_t v7(1.00); + value_t v8(amount_t("4 GBP")); + value_t v9(balance_t("4 GBP")); + value_t v10(mask_t("regex")); + value_t v11(s1); + value_t v12(string("$1")); + value_t v13("2 CAD"); + value_t v14("comment", true); + value_t v15(string("comment"), true); + value_t v16(amount_t("2")); + + v14 += v15; + BOOST_CHECK_EQUAL(v14, value_t(string("commentcomment"), true)); + v14 += v12; + BOOST_CHECK_EQUAL(v14, value_t(string("commentcomment$1.00"), true)); + + v3 += value_t(2L); + strptime("10 February 2010 00:00:02", "%d %b %Y %H:%M:%S", &localtime); + BOOST_CHECK_EQUAL(v3, value_t(boost::posix_time::from_time_t(mktime(&localtime)))); + v3 += value_t(amount_t("2")); + strptime("10 February 2010 00:00:04", "%d %b %Y %H:%M:%S", &localtime); + BOOST_CHECK_EQUAL(v3, value_t(boost::posix_time::from_time_t(mktime(&localtime)))); + + v4 += value_t(2L); + BOOST_CHECK_EQUAL(v4, value_t(date_t(parse_date("2014/08/16")))); + v4 += value_t(amount_t("2")); + BOOST_CHECK_EQUAL(v4, value_t(date_t(parse_date("2014/08/18")))); + + v5 += value_t(2L); + BOOST_CHECK_EQUAL(v5, value_t(4L)); + v5 += value_t(amount_t("2")); + BOOST_CHECK_EQUAL(v5, value_t(amount_t("6"))); + v5 += v8; + + v16 += value_t(2L); + v16 += value_t(amount_t("2")); + v16 += v8; + BOOST_CHECK_EQUAL(v5, v16); + + v8 += value_t("6"); + BOOST_CHECK_EQUAL(v8, v16); + + value_t v17(6L); + v17 += value_t(amount_t("4 GBP")); + BOOST_CHECK_EQUAL(v8, v17); + + value_t v18(6L); + v18 += v9; + value_t v19(amount_t("6")); + v19 += v9; + BOOST_CHECK_EQUAL(v18, v19); + + v9 += value_t(2L); + v9 += value_t(amount_t("4")); + v9 += v19; + v18 += v19; + BOOST_CHECK_EQUAL(v9, v18); + + value_t v20(s1); + v11 += value_t(2L); + v11 += value_t("4 GBP"); + BOOST_CHECK_THROW(v11 += v20,value_error); + BOOST_CHECK_THROW(v10 += v8, value_error); + + v20 += value_t(2L); + v20 += value_t("4 GBP"); + BOOST_CHECK_EQUAL(v11, v20); + v11 += v20; + v20 += v20; + BOOST_CHECK_EQUAL(v11, v20); + + BOOST_CHECK(v1.valid()); + BOOST_CHECK(v2.valid()); + BOOST_CHECK(v3.valid()); + BOOST_CHECK(v4.valid()); + BOOST_CHECK(v5.valid()); + BOOST_CHECK(v6.valid()); + BOOST_CHECK(v7.valid()); + BOOST_CHECK(v8.valid()); + BOOST_CHECK(v9.valid()); + BOOST_CHECK(v10.valid()); + BOOST_CHECK(v11.valid()); + BOOST_CHECK(v12.valid()); + BOOST_CHECK(v13.valid()); + BOOST_CHECK(v14.valid()); + BOOST_CHECK(v15.valid()); + BOOST_CHECK(v16.valid()); + BOOST_CHECK(v17.valid()); + BOOST_CHECK(v18.valid()); + BOOST_CHECK(v19.valid()); + BOOST_CHECK(v20.valid()); +} + +BOOST_AUTO_TEST_CASE(testSubtraction) +{ + struct tm localtime; + strptime("10 February 2010 00:00:04", "%d %b %Y %H:%M:%S", &localtime); + time_t time_var = mktime(&localtime); + value_t::sequence_t s1; + + value_t v1; + value_t v2(true); + value_t v3(boost::posix_time::from_time_t(time_var)); + value_t v4(date_t(parse_date("2014/08/18"))); + value_t v5(6L); + value_t v6(6UL); + value_t v7(1.00); + value_t v8(amount_t("4 GBP")); + value_t v9(balance_t("4 GBP")); + value_t v10(mask_t("regex")); + value_t v11(s1); + value_t v12(string("$1")); + value_t v13("2 CAD"); + value_t v14("comment", true); + value_t v15(string("comment"), true); + value_t v16(amount_t("6")); + + v3 -= value_t(2L); + strptime("10 February 2010 00:00:02", "%d %b %Y %H:%M:%S", &localtime); + BOOST_CHECK_EQUAL(v3, value_t(boost::posix_time::from_time_t(mktime(&localtime)))); + v3 -= value_t(amount_t("2")); + strptime("10 February 2010 00:00:00", "%d %b %Y %H:%M:%S", &localtime); + BOOST_CHECK_EQUAL(v3, value_t(boost::posix_time::from_time_t(mktime(&localtime)))); + + v4 -= value_t(2L); + BOOST_CHECK_EQUAL(v4, value_t(date_t(parse_date("2014/08/16")))); + v4 -= value_t(amount_t("2")); + BOOST_CHECK_EQUAL(v4, value_t(date_t(parse_date("2014/08/14")))); + + v5 -= value_t(2L); + BOOST_CHECK_EQUAL(v5, value_t(4L)); + v5 -= value_t(amount_t("2")); + BOOST_CHECK_EQUAL(v5, value_t(amount_t("2"))); + v5 -= v8; + + v16 -= value_t(2L); + v16 -= value_t(amount_t("2")); + v16 -= v8; + BOOST_CHECK_EQUAL(v5, v16); + + v8 -= value_t("2"); + BOOST_CHECK_EQUAL(-v8, v16); + + value_t v18(6L); + v18 -= v9; + value_t v19(amount_t("6")); + v19 -= v9; + BOOST_CHECK_EQUAL(v18, v19); + + v9 -= value_t(-2L); + v9 -= value_t(amount_t("-10")); + v9 -= value_t(amount_t("12 GBP")); + v9 -= v19; + BOOST_CHECK_EQUAL(v9, v18); + v18 -=v19; + BOOST_CHECK_EQUAL(v18, value_t("0")); + + value_t v20(s1); + value_t v21(2L); + value_t v22("4 GBP"); + v11.push_back(v21); + v11.push_back(v22); + BOOST_CHECK_THROW(v11 -= v20,value_error); + BOOST_CHECK_THROW(v10 -= v8, value_error); + + v20.push_back(v21); + v20.push_back(v22); + v11 -= v20; + value_t v23(s1); + v23.push_back(value_t(0L)); + v23.push_back(value_t("0")); + BOOST_CHECK_EQUAL(v11, v23); + v20 -= v21; + v20 -= v22; + BOOST_CHECK_EQUAL(v20, value_t(s1)); + + BOOST_CHECK(v1.valid()); + BOOST_CHECK(v2.valid()); + BOOST_CHECK(v3.valid()); + BOOST_CHECK(v4.valid()); + BOOST_CHECK(v5.valid()); + BOOST_CHECK(v6.valid()); + BOOST_CHECK(v7.valid()); + BOOST_CHECK(v8.valid()); + BOOST_CHECK(v9.valid()); + BOOST_CHECK(v10.valid()); + BOOST_CHECK(v11.valid()); + BOOST_CHECK(v12.valid()); + BOOST_CHECK(v13.valid()); + BOOST_CHECK(v14.valid()); + BOOST_CHECK(v15.valid()); + BOOST_CHECK(v16.valid()); + BOOST_CHECK(v18.valid()); + BOOST_CHECK(v19.valid()); + BOOST_CHECK(v20.valid()); +} + +BOOST_AUTO_TEST_CASE(testMultiplication) +{ + struct tm localtime; + strptime("10 February 2010 00:00:00", "%d %b %Y %H:%M:%S", &localtime); + time_t time_var = mktime(&localtime); + value_t::sequence_t s1; + + value_t v1; + value_t v2(true); + value_t v3(boost::posix_time::from_time_t(time_var)); + value_t v4(date_t(parse_date("2014/08/14"))); + value_t v5(2L); + value_t v6(2UL); + value_t v7(1.00); + value_t v8(amount_t("4 GBP")); + value_t v9(balance_t("4 GBP")); + value_t v10(mask_t("regex")); + value_t v11(s1); + value_t v12(string("$1")); + value_t v13("2 CAD"); + value_t v14("comment", true); + value_t v15(string("comment"), true); + value_t v16(amount_t("2")); + + v14 *= value_t(2L); + BOOST_CHECK_EQUAL(v14, value_t(string("commentcomment"), true)); + + v5 *= value_t(2L); + BOOST_CHECK_EQUAL(v5, value_t(4L)); + v5 *= value_t(amount_t("2")); + BOOST_CHECK_EQUAL(v5, value_t(amount_t("8"))); + + v16 *= value_t(2L); + v16 *= value_t(amount_t("2")); + BOOST_CHECK_EQUAL(v5, v16); + + v8 *= v9; + BOOST_CHECK_EQUAL(v8, value_t("16 GBP")); + + value_t v17(v9); + v9 *= value_t(2L); + BOOST_CHECK_EQUAL(v9, value_t("8 GBP")); + v17 += value_t(2L); + v17 *= value_t(2L); + value_t v18("8 GBP"); + v18 += value_t(4L); + BOOST_CHECK_EQUAL(v17, v18); + + value_t v20(s1); + v11.push_back(value_t(2L)); + v11.push_back(value_t("2 GBP")); + v20.push_back(value_t(4L)); + v20.push_back(value_t("4 GBP")); + v11 *= value_t(2L); + BOOST_CHECK_EQUAL(v11 ,v20); + + BOOST_CHECK_THROW(v10 *= v8, value_error); + BOOST_CHECK(v1.valid()); + BOOST_CHECK(v2.valid()); + BOOST_CHECK(v3.valid()); + BOOST_CHECK(v4.valid()); + BOOST_CHECK(v5.valid()); + BOOST_CHECK(v6.valid()); + BOOST_CHECK(v7.valid()); + BOOST_CHECK(v8.valid()); + BOOST_CHECK(v9.valid()); + BOOST_CHECK(v10.valid()); + BOOST_CHECK(v11.valid()); + BOOST_CHECK(v12.valid()); + BOOST_CHECK(v13.valid()); + BOOST_CHECK(v14.valid()); + BOOST_CHECK(v15.valid()); + BOOST_CHECK(v16.valid()); + BOOST_CHECK(v17.valid()); + BOOST_CHECK(v18.valid()); +} + +BOOST_AUTO_TEST_CASE(testDivision) +{ + struct tm localtime; + strptime("10 February 2010 00:00:00", "%d %b %Y %H:%M:%S", &localtime); + time_t time_var = mktime(&localtime); + value_t::sequence_t s1; + + value_t v1; + value_t v2(true); + value_t v3(boost::posix_time::from_time_t(time_var)); + value_t v4(date_t(parse_date("2014/08/14"))); + value_t v5(8L); + value_t v6(2UL); + value_t v7(1.00); + value_t v8(amount_t("4 GBP")); + value_t v9(balance_t("4 GBP")); + value_t v10(mask_t("regex")); + value_t v11(s1); + value_t v12(string("$1")); + value_t v13("2 CAD"); + value_t v14("comment", true); + value_t v15(string("comment"), true); + value_t v16(amount_t("8")); + + v5 /= value_t(2L); + BOOST_CHECK_EQUAL(v5, value_t(4L)); + v5 /= value_t(amount_t("8")); + BOOST_CHECK_EQUAL(v5, value_t(amount_t("2"))); + + v16 /= value_t(2L); + v16 /= value_t(amount_t("2")); + BOOST_CHECK_EQUAL(v5, v16); + + v8 /= v9; + v8 /= value_t(balance_t(2L)); + BOOST_CHECK_EQUAL(v8, value_t("0.5 GBP")); + + value_t v17(v9); + v9 /= value_t(2L); + BOOST_CHECK_EQUAL(v9, value_t("2 GBP")); + v17 /= value_t("2 GBP"); + v17 /= value_t("2"); + BOOST_CHECK_EQUAL(v17, value_t(balance_t("1 GBP"))); + + BOOST_CHECK_THROW(v10 /= v8, value_error); + BOOST_CHECK(v1.valid()); + BOOST_CHECK(v2.valid()); + BOOST_CHECK(v3.valid()); + BOOST_CHECK(v4.valid()); + BOOST_CHECK(v5.valid()); + BOOST_CHECK(v6.valid()); + BOOST_CHECK(v7.valid()); + BOOST_CHECK(v8.valid()); + BOOST_CHECK(v9.valid()); + BOOST_CHECK(v10.valid()); + BOOST_CHECK(v11.valid()); + BOOST_CHECK(v12.valid()); + BOOST_CHECK(v13.valid()); + BOOST_CHECK(v14.valid()); + BOOST_CHECK(v15.valid()); + BOOST_CHECK(v16.valid()); + BOOST_CHECK(v17.valid()); +} + +BOOST_AUTO_TEST_CASE(testType) +{ + value_t::sequence_t s1; + value_t v1; + value_t v2(true); + value_t v3(boost::posix_time::from_time_t(time_t(NULL))); + value_t v4(date_t(parse_date("2014/08/14"))); + value_t v5(2L); + value_t v6(4UL); + value_t v7(1.00); + value_t v8(amount_t("4 GBP")); + value_t v9(balance_t("3 EUR")); + value_t v10(mask_t("regex")); + value_t v11(s1); + value_t v12(string("$1")); + value_t v13("2 CAD"); + value_t v14("comment", true); + value_t v15(string("tag"), true); + + BOOST_CHECK(v1.is_null()); + BOOST_CHECK(v2.is_boolean()); + BOOST_CHECK(v3.is_datetime()); + BOOST_CHECK(v4.is_date()); + BOOST_CHECK(v5.is_long()); + BOOST_CHECK(v6.is_amount()); + BOOST_CHECK(v7.is_amount()); + BOOST_CHECK(v8.is_amount()); + BOOST_CHECK(v9.is_balance()); + BOOST_CHECK(v10.is_mask()); + BOOST_CHECK(v11.is_sequence()); + BOOST_CHECK(v12.is_amount()); + BOOST_CHECK(v13.is_amount()); + BOOST_CHECK(v14.is_string()); + BOOST_CHECK(v15.is_string()); + + BOOST_CHECK(v1.valid()); + BOOST_CHECK(v2.valid()); + BOOST_CHECK(v3.valid()); + BOOST_CHECK(v4.valid()); + BOOST_CHECK(v5.valid()); + BOOST_CHECK(v6.valid()); + BOOST_CHECK(v7.valid()); + BOOST_CHECK(v8.valid()); + BOOST_CHECK(v9.valid()); + BOOST_CHECK(v10.valid()); + BOOST_CHECK(v11.valid()); + BOOST_CHECK(v12.valid()); + BOOST_CHECK(v13.valid()); + BOOST_CHECK(v14.valid()); + BOOST_CHECK(v15.valid()); +} + +BOOST_AUTO_TEST_CASE(testForZero) +{ + value_t::sequence_t s1; + value_t v1; + value_t v2(true); + value_t v3(boost::posix_time::from_time_t(time_t(NULL))); + value_t v4(date_t(0)); + value_t v5(2L); + value_t v6(0UL); + value_t v7(1.00); + value_t v8(amount_t("4 GBP")); + value_t v9(balance_t("0")); + value_t v10(mask_t("")); + value_t v11(s1); + value_t v12(string("$1")); + value_t v13("2 CAD"); + value_t v14("comment", true); + value_t v15(string(""), true); + + BOOST_CHECK(v1.is_null()); + BOOST_CHECK(v2.is_nonzero()); + BOOST_CHECK(!v3.is_zero()); + BOOST_CHECK(v4.is_nonzero()); + BOOST_CHECK(v5.is_nonzero()); + BOOST_CHECK(v6.is_realzero()); + BOOST_CHECK(v7.is_nonzero()); + BOOST_CHECK(v8.is_nonzero()); + BOOST_CHECK(v9.is_zero()); + BOOST_CHECK_THROW(v10.is_zero(), value_error); + BOOST_CHECK(v11.is_zero()); + BOOST_CHECK(v12.is_nonzero()); + BOOST_CHECK(v13.is_nonzero()); + BOOST_CHECK(v14.is_nonzero()); + BOOST_CHECK(v15.is_zero()); + + v11.push_back(v6); + BOOST_CHECK(v11.is_nonzero()); + + BOOST_CHECK(v1.valid()); + BOOST_CHECK(v2.valid()); + BOOST_CHECK(v3.valid()); + BOOST_CHECK(v4.valid()); + BOOST_CHECK(v5.valid()); + BOOST_CHECK(v6.valid()); + BOOST_CHECK(v7.valid()); + BOOST_CHECK(v8.valid()); + BOOST_CHECK(v9.valid()); + BOOST_CHECK(v10.valid()); + BOOST_CHECK(v11.valid()); + BOOST_CHECK(v12.valid()); + BOOST_CHECK(v13.valid()); + BOOST_CHECK(v14.valid()); + BOOST_CHECK(v15.valid()); +} + +BOOST_AUTO_TEST_CASE(testNegation) +{ + value_t::sequence_t s1; + value_t v1; + value_t v2(true); + value_t v3(boost::posix_time::from_time_t(time_t(NULL))); + value_t v4(date_t(parse_date("2014/08/09"))); + value_t v5(2L); + value_t v6(0UL); + value_t v7(1.00); + value_t v8(amount_t("4 GBP")); + value_t v9(balance_t("4 GBP")); + value_t v10(mask_t("")); + value_t v11(s1); + value_t v12(string("$1")); + value_t v13("$-1"); + value_t v14("comment", true); + value_t v15(string("comment"), true); + + BOOST_CHECK_THROW(v1.negated(), value_error); + BOOST_CHECK_EQUAL(v2.negated(), value_t(false)); + v5.in_place_negate(); + BOOST_CHECK_EQUAL(v5, value_t(-2L)); + v8.in_place_negate(); + v9.in_place_negate(); + BOOST_CHECK_EQUAL(v8, v9); + BOOST_CHECK_THROW(v10.negated(), value_error); + BOOST_CHECK_EQUAL(-v12, v13); + BOOST_CHECK_THROW(-v14, value_error); + + BOOST_CHECK(v1.valid()); + BOOST_CHECK(v2.valid()); + BOOST_CHECK(v3.valid()); + BOOST_CHECK(v4.valid()); + BOOST_CHECK(v5.valid()); + BOOST_CHECK(v6.valid()); + BOOST_CHECK(v7.valid()); + BOOST_CHECK(v8.valid()); + BOOST_CHECK(v9.valid()); + BOOST_CHECK(v10.valid()); + BOOST_CHECK(v11.valid()); + BOOST_CHECK(v12.valid()); + BOOST_CHECK(v13.valid()); + BOOST_CHECK(v14.valid()); + BOOST_CHECK(v15.valid()); +} + +BOOST_AUTO_TEST_SUITE_END() + diff --git a/tools/build.sh b/tools/build.sh index ba563e34..b7a80587 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -4,8 +4,8 @@ flavor=$1 shift 1 JOBS=-j$(sysctl -n hw.activecpu) -OPTIONS="$flavor --debug --python --ninja --doxygen $JOBS" -OPTIONS="$OPTIONS --prefix /usr/local/Cellar/ledger/HEAD" +#OPTIONS="$flavor --debug --python --ninja --doxygen $JOBS" +OPTIONS="$flavor --debug --ninja $JOBS" time ( \ cd ~/src/ledger ; \ 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 diff --git a/tools/prepare-commit-msg b/tools/prepare-commit-msg new file mode 100755 index 00000000..e103888a --- /dev/null +++ b/tools/prepare-commit-msg @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Prepare git commit message: +# - Add [ci skip] if the changes seem irrelevant for continuous integration + +# Add [ci skip] to the commit message unless there are changes to files +# that are relevant for testing such as src/*, test/*, ledger3.texi, ... +function add_ci_skip() +{ + pattern="$1"; shift + if [ $(git diff --cached --name-only | grep --count "$pattern") -eq 0 ]; then + tempfile=$(mktemp $0.XXXXXX) + cat - "$1" <<EOF > "$tempfile" + +# It seems the changes to be committed are irrelevant for the continuous +# integration, therefore it will be skipped for this commit. +# +# If you still want continuous integration to run for this commit +# comment or remove the next line. +[ci skip] +EOF + mv "$tempfile" "$1" + fi +} + +## MAIN +add_ci_skip '\(^src\|^test\|^doc/ledger3.texi\|^\.travis.yml\|CMakeLists.txt\)' "$@" diff --git a/tools/spellcheck.sh b/tools/spellcheck.sh index ae86a3d6..182f32cb 100755 --- a/tools/spellcheck.sh +++ b/tools/spellcheck.sh @@ -1,3 +1,3 @@ #!/bin/sh -aspell check --mode=texinfo ledger3.texi
\ No newline at end of file +aspell --lang=en_US.UTF-8 check --mode=texinfo $(dirname $0)/../doc/ledger3.texi diff --git a/tools/travis-before_install.sh b/tools/travis-before_install.sh new file mode 100755 index 00000000..a1800021 --- /dev/null +++ b/tools/travis-before_install.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +#set -x +set -e +set -o pipefail + +if [ "${TRAVIS_OS_NAME}" = "osx" ]; then + brew update +fi + +if [ -n "${BOOST_VERSION}" ]; then + echo "Downloading boost ${BOOST_VERSION}" + mkdir -p $BOOST_ROOT + wget --no-verbose --output-document=- \ + http://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/boost_${BOOST_VERSION//./_}.tar.bz2/download \ + | tar jxf - --strip-components=1 -C "${BOOST_ROOT}" +fi diff --git a/tools/travis-install.sh b/tools/travis-install.sh new file mode 100755 index 00000000..b5039d5c --- /dev/null +++ b/tools/travis-install.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +#set -x +set -e +set -o pipefail + +if [ "${TRAVIS_OS_NAME}" = "osx" ]; then + for formula in $(echo "${BREWS//,/ }"); do + echo "Checking ${formula} formula" + brew outdated "${formula}" \ + || (brew unlink "${formula}" + brew install "${formula}" + ) + done +fi + +if [ -d "${BOOST_ROOT}" ]; then + echo "Installing boost ${BOOST_VERSION} in ${BOOST_ROOT}" + (cd "${BOOST_ROOT}" + ./bootstrap.sh --with-libraries="${BOOST_LIBS}" + ./b2 threading=multi --prefix="${BOOST_ROOT}" -d0 install + ) +fi |