summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-17 21:30:07 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-17 21:51:51 -0500
commitc28d828d8e24fe637a74674bedc9bc0cbdabca1c (patch)
tree5b549d4af694193d950162890ae1c5150a24b73a
parent4bc830a2c526cad108695104503f377997e14e7e (diff)
downloadfork-ledger-c28d828d8e24fe637a74674bedc9bc0cbdabca1c.tar.gz
fork-ledger-c28d828d8e24fe637a74674bedc9bc0cbdabca1c.tar.bz2
fork-ledger-c28d828d8e24fe637a74674bedc9bc0cbdabca1c.zip
Renamed date_interval_t::end to finish
-rw-r--r--src/filters.cc6
-rw-r--r--src/precmd.cc8
-rw-r--r--src/query.cc4
-rw-r--r--src/report.cc4
-rw-r--r--src/times.cc76
-rw-r--r--src/times.h6
-rw-r--r--test/regress/7F3650FD.test10
-rw-r--r--test/regress/BBFA1759.test2
8 files changed, 58 insertions, 58 deletions
diff --git a/src/filters.cc b/src/filters.cc
index bef4dc24..5a92421b 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -784,7 +784,7 @@ void budget_posts::report_budget_items(const date_t& date)
assert(begin);
if (*begin <= date &&
- (! pair.first.end || *begin < *pair.first.end)) {
+ (! pair.first.finish || *begin < *pair.first.finish)) {
post_t& post = *pair.second;
DEBUG("budget.generate", "Reporting budget for "
@@ -905,8 +905,8 @@ void forecast_posts::flush()
}
date_t& begin = *(*least).first.start;
- if ((*least).first.end)
- assert(begin < *(*least).first.end);
+ if ((*least).first.finish)
+ assert(begin < *(*least).first.finish);
// If the next date in the series for this periodic posting is more than 5
// years beyond the last valid post we generated, drop it from further
diff --git a/src/precmd.cc b/src/precmd.cc
index 92483dc8..c4d7cbaa 100644
--- a/src/precmd.cc
+++ b/src/precmd.cc
@@ -173,8 +173,8 @@ value_t period_command(call_scope_t& args)
out << _(" start: ") << format_date(*interval.start) << std::endl;
else
out << _(" start: TODAY: ") << format_date(CURRENT_DATE()) << std::endl;
- if (interval.end)
- out << _(" end: ") << format_date(*interval.end) << std::endl;
+ if (interval.finish)
+ out << _(" finish: ") << format_date(*interval.finish) << std::endl;
if (interval.skip_duration)
out << _(" skip: ") << *interval.skip_duration << std::endl;
@@ -191,8 +191,8 @@ value_t period_command(call_scope_t& args)
if (interval.start)
out << _(" start: ") << format_date(*interval.start) << std::endl;
- if (interval.end)
- out << _(" end: ") << format_date(*interval.end) << std::endl;
+ if (interval.finish)
+ out << _(" finish: ") << format_date(*interval.finish) << std::endl;
if (interval.skip_duration)
out << _(" skip: ") << *interval.skip_duration << std::endl;
diff --git a/src/query.cc b/src/query.cc
index bf4eb62a..2d6085fa 100644
--- a/src/query.cc
+++ b/src/query.cc
@@ -263,12 +263,12 @@ query_t::parser_t::parse_query_term(query_t::lexer_t::token_t::kind_t tok_contex
node->set_right(arg1);
}
- if (interval.end) {
+ if (interval.finish) {
expr_t::ptr_op_t lt = new expr_t::op_t(expr_t::op_t::O_LT);
lt->set_left(ident);
expr_t::ptr_op_t arg1 = new expr_t::op_t(expr_t::op_t::VALUE);
- arg1->set_value(*interval.end);
+ arg1->set_value(*interval.finish);
lt->set_right(arg1);
if (node) {
diff --git a/src/report.cc b/src/report.cc
index 267a4a3d..efe162e2 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -125,9 +125,9 @@ void report_t::normalize_options(const string& verb)
"date>=[" + to_iso_extended_string(*interval.start) + "]";
HANDLER(limit_).on(string("?normalize"), predicate);
}
- if (! HANDLED(end_) && interval.end) {
+ if (! HANDLED(end_) && interval.finish) {
string predicate =
- "date<[" + to_iso_extended_string(*interval.end) + "]";
+ "date<[" + to_iso_extended_string(*interval.finish) + "]";
HANDLER(limit_).on(string("?normalize"), predicate);
}
diff --git a/src/times.cc b/src/times.cc
index 6afbab0a..8ab0c12c 100644
--- a/src/times.cc
+++ b/src/times.cc
@@ -345,8 +345,8 @@ void date_interval_t::resolve_end()
"stabilize: end_of_duration = " << *end_of_duration);
}
- if (end && *end_of_duration > *end) {
- end_of_duration = end;
+ if (finish && *end_of_duration > *finish) {
+ end_of_duration = finish;
DEBUG("times.interval",
"stabilize: end_of_duration reset to end: " << *end_of_duration);
}
@@ -384,16 +384,16 @@ void date_interval_t::stabilize(const optional<date_t>& date)
// want a date early enough that the range will be correct, but late
// enough that we don't spend hundreds of thousands of loops skipping
// through time.
- optional<date_t> initial_start = start;
- optional<date_t> initial_end = end;
+ optional<date_t> initial_start = start;
+ optional<date_t> initial_finish = finish;
#if defined(DEBUG_ON)
if (initial_start)
DEBUG("times.interval",
"stabilize: initial_start = " << *initial_start);
- if (initial_end)
+ if (initial_finish)
DEBUG("times.interval",
- "stabilize: initial_end = " << *initial_end);
+ "stabilize: initial_finish = " << *initial_finish);
#endif
date_t when = start ? *start : *date;
@@ -439,22 +439,22 @@ void date_interval_t::stabilize(const optional<date_t>& date)
start = initial_start;
DEBUG("times.interval", "stabilize: start reset to initial start");
}
- if (initial_end && (! end || *end > *initial_end)) {
- end = initial_end;
- DEBUG("times.interval", "stabilize: end reset to initial end");
+ if (initial_finish && (! finish || *finish > *initial_finish)) {
+ finish = initial_finish;
+ DEBUG("times.interval", "stabilize: finish reset to initial finish");
}
}
aligned = true;
}
// If there is no duration, then if we've reached here the date falls
- // between begin and end.
+ // between start and finish.
if (! duration) {
DEBUG("times.interval", "stabilize: there was no duration given");
- if (! start && ! end)
+ if (! start && ! finish)
throw_(date_error,
- _("Invalid date interval: neither start, nor end, nor duration"));
+ _("Invalid date interval: neither start, nor finish, nor duration"));
} else {
resolve_end();
}
@@ -464,9 +464,9 @@ bool date_interval_t::find_period(const date_t& date)
{
stabilize(date);
- if (end && date > *end) {
+ if (finish && date > *finish) {
DEBUG("times.interval",
- "false: date [" << date << "] > end [" << *end << "]");
+ "false: date [" << date << "] > finish [" << *finish << "]");
return false;
}
@@ -503,7 +503,7 @@ bool date_interval_t::find_period(const date_t& date)
DEBUG("times.interval", "scan = " << scan);
DEBUG("times.interval", "end_of_scan = " << end_of_scan);
- while (date >= scan && (! end || scan < *end)) {
+ while (date >= scan && (! finish || scan < *finish)) {
if (date < end_of_scan) {
start = scan;
end_of_duration = end_of_scan;
@@ -535,7 +535,7 @@ date_interval_t& date_interval_t::operator++()
assert(next);
- if (end && *next >= *end) {
+ if (finish && *next >= *finish) {
start = none;
} else {
start = *next;
@@ -586,8 +586,8 @@ namespace {
void parse_date_words(std::istream& in,
string& word,
date_interval_t& interval,
- bool look_for_start = true,
- bool look_for_end = true)
+ bool look_for_start = true,
+ bool look_for_finish = true)
{
string type;
@@ -602,12 +602,12 @@ namespace {
}
date_t start = CURRENT_DATE();
- date_t end;
+ date_t finish;
bool parse_specifier = false;
optional<date_interval_t::duration_t> duration;
- assert(look_for_start || look_for_end);
+ assert(look_for_start || look_for_finish);
if (word == _("year")) {
duration = date_interval_t::duration_t(date_interval_t::duration_t::YEARS, 1);
@@ -625,21 +625,21 @@ namespace {
}
if (parse_specifier)
- parse_inclusion_specifier(word, &start, &end);
+ parse_inclusion_specifier(word, &start, &finish);
else
- end = duration->add(start);
+ finish = duration->add(start);
if (type == _("last") && duration) {
start = duration->subtract(start);
- end = duration->subtract(end);
+ finish = duration->subtract(finish);
}
else if (type == _("next") && duration) {
start = duration->add(start);
- end = duration->add(end);
+ finish = duration->add(finish);
}
- if (look_for_start && is_valid(start)) interval.start = start;
- if (look_for_end && is_valid(end)) interval.end = end;
+ if (look_for_start && is_valid(start)) interval.start = start;
+ if (look_for_finish && is_valid(finish)) interval.finish = finish;
}
}
@@ -723,10 +723,10 @@ void date_interval_t::parse(std::istream& in)
}
else {
// otherwise, it should be an explicit date
- date_t b, e;
- parse_inclusion_specifier(word, &b, &e);
- start = b;
- end = e;
+ date_t s, f;
+ parse_inclusion_specifier(word, &s, &f);
+ start = s;
+ finish = f;
}
}
@@ -738,23 +738,23 @@ void date_interval_t::parse(std::istream& in)
while (start->day_of_week() != *wday)
*start -= gregorian::days(1);
- if (! end)
- end = *start + gregorian::days(1);
+ if (! finish)
+ finish = *start + gregorian::days(1);
} else {
- bool overwrite_end = false;
+ bool overwrite_finish = false;
if (year) {
start = date_t(*year, 1, 1);
- if (! end) {
- end = *start + gregorian::years(1);
- overwrite_end = true;
+ if (! finish) {
+ finish = *start + gregorian::years(1);
+ overwrite_finish = true;
}
}
if (mon) {
start = date_t(start->year(), *mon, 1);
- if (! end || overwrite_end)
- end = *start + gregorian::months(1);
+ if (! finish || overwrite_finish)
+ finish = *start + gregorian::months(1);
}
}
}
diff --git a/src/times.h b/src/times.h
index 77f25d9e..84970cd2 100644
--- a/src/times.h
+++ b/src/times.h
@@ -219,7 +219,7 @@ public:
optional<date_t> next;
optional<duration_t> duration;
optional<date_t> end_of_duration;
- optional<date_t> end;
+ optional<date_t> finish;
explicit date_interval_t() : aligned(false), factor(1) {
TRACE_CTOR(date_interval_t, "");
@@ -236,7 +236,7 @@ public:
next(other.next),
duration(other.duration),
end_of_duration(other.end_of_duration),
- end(other.end) {
+ finish(other.finish) {
TRACE_CTOR(date_interval_t, "copy");
}
~date_interval_t() throw() {
@@ -295,7 +295,7 @@ private:
ar & next;
ar & duration;
ar & end_of_duration;
- ar & end;
+ ar & finish;
}
#endif // HAVE_BOOST_SERIALIZATION
};
diff --git a/test/regress/7F3650FD.test b/test/regress/7F3650FD.test
index 0eb3a96f..dce5233f 100644
--- a/test/regress/7F3650FD.test
+++ b/test/regress/7F3650FD.test
@@ -4,7 +4,7 @@ period --now=2010/11/01 12/01
global details =>
start: 09-Dec-01
- end: 09-Dec-02
+ finish: 09-Dec-02
factor: 1
>>>2
=== 0
@@ -14,7 +14,7 @@ period --now=2010/11/01 10/01
global details =>
start: 10-Oct-01
- end: 10-Oct-02
+ finish: 10-Oct-02
factor: 1
>>>2
=== 0
@@ -24,7 +24,7 @@ period --now=2010/11/01 2009/10
global details =>
start: 09-Oct-01
- end: 09-Nov-01
+ finish: 09-Nov-01
factor: 1
>>>2
=== 0
@@ -34,7 +34,7 @@ period --now=2010/11/01 2009/10/01
global details =>
start: 09-Oct-01
- end: 09-Oct-02
+ finish: 09-Oct-02
factor: 1
>>>2
=== 0
@@ -44,7 +44,7 @@ period --now=2010/11/01 2009
global details =>
start: 09-Jan-01
- end: 10-Jan-01
+ finish: 10-Jan-01
factor: 1
>>>2
=== 0
diff --git a/test/regress/BBFA1759.test b/test/regress/BBFA1759.test
index 26862703..b109f868 100644
--- a/test/regress/BBFA1759.test
+++ b/test/regress/BBFA1759.test
@@ -4,7 +4,7 @@ period june 2008
global details =>
start: 08-Jun-01
- end: 08-Jul-01
+ finish: 08-Jul-01
factor: 1
>>>2
=== 0