From 911b86623047bdadd2ac6fde2f8006d9b1c672f8 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 19 Jul 2008 16:52:16 -0400 Subject: When converting datetime_t to a long, I now need to directly access the 'when' member, otherwise C++ chooses the bool conversion, which is always wrong. --- value.cc | 10 +++++----- walk.cc | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/value.cc b/value.cc index 1ced0b96..4bb74650 100644 --- a/value.cc +++ b/value.cc @@ -630,7 +630,7 @@ bool value_t::operator OP(const value_t& value) \ \ case DATETIME: \ return (*((long *) data) OP \ - ((long) *((datetime_t *) value.data))); \ + ((long) ((datetime_t *) value.data)->when)); \ \ case AMOUNT: \ return (amount_t(*((long *) data)) OP \ @@ -657,7 +657,7 @@ bool value_t::operator OP(const value_t& value) \ \ case INTEGER: \ return (*((datetime_t *) data) OP \ - datetime_t(*((long *) value.data))); \ + datetime_t(std::time_t(*((long *) value.data)))); \ \ case DATETIME: \ return (*((datetime_t *) data) OP \ @@ -786,7 +786,7 @@ value_t::operator long() const case INTEGER: return *((long *) data); case DATETIME: - return *((datetime_t *) data); + return ((datetime_t *) data)->when; case AMOUNT: return *((amount_t *) data); case BALANCE: @@ -884,7 +884,7 @@ void value_t::cast(type_t cast_type) case INTEGER: break; case DATETIME: - *((datetime_t *) data) = datetime_t(*((long *) data)); + *((datetime_t *) data) = datetime_t(std::time_t(*((long *) data))); break; case AMOUNT: new((amount_t *)data) amount_t(*((long *) data)); @@ -908,7 +908,7 @@ void value_t::cast(type_t cast_type) *((bool *) data) = *((datetime_t *) data); break; case INTEGER: - *((long *) data) = *((datetime_t *) data); + *((long *) data) = ((datetime_t *) data)->when; break; case DATETIME: break; diff --git a/walk.cc b/walk.cc index b3b024f5..88b5461a 100644 --- a/walk.cc +++ b/walk.cc @@ -28,6 +28,11 @@ bool compare_items::operator()(const transaction_t * left, rxdata.dflags |= TRANSACTION_SORT_CALC; } + DEBUG_PRINT("ledger.walk.compare_items_xact", + "lxdata.sort_value = " << lxdata.sort_value); + DEBUG_PRINT("ledger.walk.compare_items_xact", + "rxdata.sort_value = " << rxdata.sort_value); + return lxdata.sort_value < rxdata.sort_value; } -- cgit v1.2.3 From 8e49f5242f191e9937e09b8d9c4c17b1b2ed971d Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 19 Jul 2008 21:31:36 -0400 Subject: Erroneously compared a character position to NUL, rather than setting it. --- textual.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/textual.cc b/textual.cc index 131c6da2..4e011189 100644 --- a/textual.cc +++ b/textual.cc @@ -348,7 +348,7 @@ bool parse_transactions(std::istream& in, int len = std::strlen(line); if (line[len - 1] == '\r') - line[--len] == '\0'; + line[--len] = '\0'; beg_pos += len + 1; linenum++; @@ -444,7 +444,7 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master, int len = std::strlen(line); if (line[len - 1] == '\r') - line[--len] == '\0'; + line[--len] = '\0'; end_pos = beg_pos + len + 1; linenum++; @@ -631,7 +631,7 @@ unsigned int textual_parser_t::parse(std::istream& in, int len = std::strlen(line); if (line[len - 1] == '\r') - line[--len] == '\0'; + line[--len] = '\0'; end_pos = beg_pos + len + 1; linenum++; -- cgit v1.2.3 From 00a47a38f686440b937aecd889c75679084d0a64 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 20 Jul 2008 20:31:20 -0400 Subject: Corrected the copyright date in ledger.el. --- ledger.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ledger.el b/ledger.el index d7b5a005..abdefdfb 100644 --- a/ledger.el +++ b/ledger.el @@ -1,11 +1,11 @@ ;;; ledger.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2007 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2008 John Wiegley (johnw AT gnu DOT org) ;; Emacs Lisp Archive Entry ;; Filename: ledger.el ;; Version: 2.6.1 -;; Date: Thu 18-Jul-2008 +;; Date: Fri 18-Jul-2008 ;; Keywords: data ;; Author: John Wiegley (johnw AT gnu DOT org) ;; Maintainer: John Wiegley (johnw AT gnu DOT org) -- cgit v1.2.3 From 025c9acda9b113df37e9ceaff69a028b181baf66 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 20 Jul 2008 20:31:53 -0400 Subject: When using the "entry" command with an unknown payee, get the draw account correct if one is specified. Fixes #203. --- derive.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/derive.cc b/derive.cc index 296d9957..1b74578f 100644 --- a/derive.cc +++ b/derive.cc @@ -72,10 +72,21 @@ entry_t * derive_new_entry(journal_t& journal, } } - if (journal.basket) - acct = journal.basket; - else - acct = journal.find_account("Equity"); + acct = NULL; + + if (i != end) { + if (! acct) + acct = journal.find_account_re(*i); + if (! acct) + acct = journal.find_account(*i); + } + + if (! acct) { + if (journal.basket) + acct = journal.basket; + else + acct = journal.find_account("Equity"); + } added->add_transaction(new transaction_t(acct)); } -- cgit v1.2.3 From 0c800d968cd0ec45d841a8597c293eb11a6456dd Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 21 Jul 2008 06:22:03 -0400 Subject: A patch from Juergen Daubert, which fixes the output from --version. --- configure.in | 2 +- option.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 8ef800f8..866334f0 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT(ledger, 2.6.0.90, johnw@newartisans.com) +AC_INIT(ledger, 2.6.1, johnw@newartisans.com) AM_INIT_AUTOMAKE(ledger, 2.6.1) AC_CONFIG_SRCDIR([main.cc]) AC_CONFIG_HEADER([acconf.h]) diff --git a/option.cc b/option.cc index 6cb2130d..624a8f0b 100644 --- a/option.cc +++ b/option.cc @@ -189,7 +189,7 @@ report_t * report = NULL; static void show_version(std::ostream& out) { out << "Ledger " << ledger::version << ", the command-line accounting tool"; - out << "\n\nCopyright (c) 2003-2006, John Wiegley. All rights reserved.\n\n\ + out << "\n\nCopyright (c) 2003-2008, 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.\n"; out << "\n(modules: gmp, pcre"; -- cgit v1.2.3 From b1370b654da241ca7674b366e8007d1d6915094e Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 21 Jul 2008 06:29:40 -0400 Subject: More copyright date updates. --- LICENSE | 2 +- ledger.texi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 4623f1ff..f4b7f221 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2003-2006, John Wiegley. All rights reserved. +Copyright (c) 2003-2008, 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/ledger.texi b/ledger.texi index d59121a5..4b995e78 100644 --- a/ledger.texi +++ b/ledger.texi @@ -5,7 +5,7 @@ @dircategory User Applications @copying -Copyright (c) 2003-2006, John Wiegley. All rights reserved. +Copyright (c) 2003-2008, 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 -- cgit v1.2.3