Merge branch 'next'
This commit is contained in:
commit
423d674c6b
18 changed files with 9 additions and 122 deletions
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "balance.h"
|
||||
#include "commodity.h"
|
||||
#include "annotate.h"
|
||||
#include "pool.h"
|
||||
#include "unistring.h" // for justify()
|
||||
|
||||
|
|
@ -220,10 +221,9 @@ balance_t::commodity_amount(const optional<const commodity_t&>& commodity) const
|
|||
if (amounts.size() == 1) {
|
||||
return amounts.begin()->second;
|
||||
}
|
||||
#if 0
|
||||
else if (amounts.size() > 1) {
|
||||
// Try stripping annotations before giving an error.
|
||||
balance_t temp(strip_annotations());
|
||||
balance_t temp(strip_annotations(keep_details_t()));
|
||||
if (temp.amounts.size() == 1)
|
||||
return temp.commodity_amount(commodity);
|
||||
|
||||
|
|
@ -231,7 +231,6 @@ balance_t::commodity_amount(const optional<const commodity_t&>& commodity) const
|
|||
_("Requested amount of a balance with multiple commodities: %1")
|
||||
<< temp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (amounts.size() > 0) {
|
||||
amounts_map::const_iterator i =
|
||||
|
|
|
|||
|
|
@ -360,12 +360,6 @@ optional<commodity_t::base_t::history_t&>
|
|||
if (! commodity) {
|
||||
if (histories.size() > 1)
|
||||
return none;
|
||||
#if 0
|
||||
// jww (2008-09-20): Document which option switch to use here
|
||||
throw_(commodity_error,
|
||||
_("Cannot determine price history: "
|
||||
"prices known for multiple commodities (use -x)"));
|
||||
#endif
|
||||
comm = (*histories.begin()).first;
|
||||
} else {
|
||||
comm = &(*commodity);
|
||||
|
|
|
|||
|
|
@ -548,7 +548,7 @@ value_t xact_command(call_scope_t& args)
|
|||
xact_template_t tmpl = args_to_xact_template(begin, end);
|
||||
std::auto_ptr<xact_t> new_xact(derive_xact_from_template(tmpl, report));
|
||||
|
||||
// jww (2009-02-27): make this more general
|
||||
// Only consider actual postings for the "xact" command
|
||||
report.HANDLER(limit_).on(string("#xact"), "actual");
|
||||
|
||||
report.xact_report(post_handler_ptr
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void format_emacs_posts::write_xact(xact_t& xact)
|
|||
<< xact.pos->beg_line << " ";
|
||||
|
||||
tm when = gregorian::to_tm(xact.date());
|
||||
std::time_t date = std::mktime(&when); // jww (2008-04-20): Is this GMT or local?
|
||||
std::time_t date = std::mktime(&when);
|
||||
|
||||
out << "(" << (date / 65536) << " " << (date % 65536) << " 0) ";
|
||||
|
||||
|
|
|
|||
|
|
@ -784,7 +784,6 @@ void budget_posts::operator()(post_t& post)
|
|||
if (acct == (*pair.second).reported_account()) {
|
||||
post_in_budget = true;
|
||||
// Report the post as if it had occurred in the parent account.
|
||||
// jww (2009-10-27): What about calling add_post here?
|
||||
if (post.reported_account() != acct)
|
||||
post.xdata().account = acct;
|
||||
goto handle;
|
||||
|
|
|
|||
|
|
@ -210,13 +210,11 @@ string generate_posts_iterator::generate_amount(std::ostream& out,
|
|||
generate_amount(buf, value_t(), true);
|
||||
buf << '}';
|
||||
}
|
||||
#if 0
|
||||
if (six_gen() == 1) {
|
||||
buf << " [";
|
||||
generate_date(buf);
|
||||
buf << ']';
|
||||
}
|
||||
#endif
|
||||
if (six_gen() == 1) {
|
||||
buf << " (";
|
||||
generate_string(buf, six_gen());
|
||||
|
|
|
|||
|
|
@ -431,7 +431,6 @@ void global_scope_t::normalize_report_options(const string& verb)
|
|||
}
|
||||
#endif
|
||||
|
||||
// jww (2009-02-09): These globals are a hack, but hard to avoid.
|
||||
item_t::use_effective_date = (rep.HANDLED(effective) &&
|
||||
! rep.HANDLED(actual_dates));
|
||||
|
||||
|
|
@ -458,9 +457,6 @@ void global_scope_t::normalize_report_options(const string& verb)
|
|||
start_of_week = *weekday;
|
||||
}
|
||||
|
||||
// jww (2008-08-14): This code really needs to be rationalized away for 3.0.
|
||||
// I might be able to do it with command objects, like register_t, which
|
||||
// each know how to adjust the report based on its current option settings.
|
||||
if (verb == "print" || verb == "xact" || verb == "dump") {
|
||||
rep.HANDLER(related).on_only(string("?normalize"));
|
||||
rep.HANDLER(related_all).on_only(string("?normalize"));
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ class item_t : public supports_flags<>, public scope_t
|
|||
{
|
||||
public:
|
||||
#define ITEM_NORMAL 0x00 // no flags at all, a basic posting
|
||||
// jww (2009-10-27): I'm not consistent on the difference between these two.
|
||||
#define ITEM_GENERATED 0x01 // posting was not found in a journal
|
||||
#define ITEM_TEMP 0x02 // posting is a managed temporary
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@
|
|||
#include "xact.h"
|
||||
#include "account.h"
|
||||
#include "interactive.h"
|
||||
#include "unistring.h" // jww (2009-03-04): really??
|
||||
#include "format.h" // jww (2009-03-04): really??
|
||||
#include "unistring.h"
|
||||
#include "format.h"
|
||||
|
||||
namespace ledger {
|
||||
|
||||
|
|
|
|||
|
|
@ -119,9 +119,6 @@ void export_amount()
|
|||
make_getter(&amount_t::stream_fullstrings),
|
||||
make_setter(&amount_t::stream_fullstrings))
|
||||
|
||||
#if 0
|
||||
.def(init<double>())
|
||||
#endif
|
||||
.def(init<long>())
|
||||
.def(init<std::string>())
|
||||
|
||||
|
|
@ -137,108 +134,56 @@ internal precision."))
|
|||
.def(self == self)
|
||||
.def(self == long())
|
||||
.def(long() == self)
|
||||
#if 0
|
||||
.def(self == double())
|
||||
.def(double() == self)
|
||||
#endif
|
||||
|
||||
.def(self != self)
|
||||
.def(self != long())
|
||||
.def(long() != self)
|
||||
#if 0
|
||||
.def(self != double())
|
||||
.def(double() != self)
|
||||
#endif
|
||||
|
||||
.def(! self)
|
||||
|
||||
.def(self < self)
|
||||
.def(self < long())
|
||||
.def(long() < self)
|
||||
#if 0
|
||||
.def(self < double())
|
||||
.def(double() < self)
|
||||
#endif
|
||||
|
||||
.def(self <= self)
|
||||
.def(self <= long())
|
||||
.def(long() <= self)
|
||||
#if 0
|
||||
.def(self <= double())
|
||||
.def(double() <= self)
|
||||
#endif
|
||||
|
||||
.def(self > self)
|
||||
.def(self > long())
|
||||
.def(long() > self)
|
||||
#if 0
|
||||
.def(self > double())
|
||||
.def(double() > self)
|
||||
#endif
|
||||
|
||||
.def(self >= self)
|
||||
.def(self >= long())
|
||||
.def(long() >= self)
|
||||
#if 0
|
||||
.def(self >= double())
|
||||
.def(double() >= self)
|
||||
#endif
|
||||
|
||||
.def(self += self)
|
||||
.def(self += long())
|
||||
#if 0
|
||||
.def(self += double())
|
||||
#endif
|
||||
|
||||
.def(self + self)
|
||||
.def(self + long())
|
||||
.def(long() + self)
|
||||
#if 0
|
||||
.def(self + double())
|
||||
.def(double() + self)
|
||||
#endif
|
||||
|
||||
.def(self -= self)
|
||||
.def(self -= long())
|
||||
#if 0
|
||||
.def(self -= double())
|
||||
#endif
|
||||
|
||||
.def(self - self)
|
||||
.def(self - long())
|
||||
.def(long() - self)
|
||||
#if 0
|
||||
.def(self - double())
|
||||
.def(double() - self)
|
||||
#endif
|
||||
|
||||
.def(self *= self)
|
||||
.def(self *= long())
|
||||
#if 0
|
||||
.def(self *= double())
|
||||
#endif
|
||||
|
||||
.def(self * self)
|
||||
.def(self * long())
|
||||
.def(long() * self)
|
||||
#if 0
|
||||
.def(self * double())
|
||||
.def(double() * self)
|
||||
#endif
|
||||
|
||||
.def(self /= self)
|
||||
.def(self /= long())
|
||||
#if 0
|
||||
.def(self /= double())
|
||||
#endif
|
||||
|
||||
.def(self / self)
|
||||
.def(self / long())
|
||||
.def(long() / self)
|
||||
#if 0
|
||||
.def(self / double())
|
||||
.def(double() / self)
|
||||
#endif
|
||||
|
||||
.def("precision", &amount_t::precision)
|
||||
|
||||
|
|
@ -326,9 +271,6 @@ internal precision."))
|
|||
|
||||
register_optional_to_python<amount_t>();
|
||||
|
||||
#if 0
|
||||
implicitly_convertible<double, amount_t>();
|
||||
#endif
|
||||
implicitly_convertible<long, amount_t>();
|
||||
implicitly_convertible<string, amount_t>();
|
||||
|
||||
|
|
|
|||
|
|
@ -80,12 +80,10 @@ namespace {
|
|||
void export_value()
|
||||
{
|
||||
class_< value_t > ("Value")
|
||||
#if 0
|
||||
.def("initialize", &value_t::initialize)
|
||||
.staticmethod("initialize")
|
||||
.def("shutdown", &value_t::shutdown)
|
||||
.staticmethod("shutdown")
|
||||
#endif
|
||||
|
||||
.def(init<double>())
|
||||
.def(init<long>())
|
||||
|
|
|
|||
|
|
@ -101,9 +101,6 @@ commodity_quote_from_script(commodity_t& commodity,
|
|||
exchange_commodity->symbol() : "''") << "\")");
|
||||
|
||||
// Don't try to download this commodity again.
|
||||
|
||||
// jww (2009-06-24): This flag should be removed in order to try again
|
||||
// when using a GUI.
|
||||
commodity.add_flags(COMMODITY_NOMARKET);
|
||||
}
|
||||
return none;
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
|
||||
#include "report.h"
|
||||
#include "session.h"
|
||||
#include "unistring.h" // jww (2009-03-04): really??
|
||||
#include "format.h" // jww (2009-03-04): really??
|
||||
#include "unistring.h"
|
||||
#include "format.h"
|
||||
#include "output.h"
|
||||
#include "iterators.h"
|
||||
#include "filters.h"
|
||||
|
|
@ -55,7 +55,6 @@ void report_t::posts_report(post_handler_ptr handler)
|
|||
|
||||
void report_t::generate_report(post_handler_ptr handler)
|
||||
{
|
||||
// jww (2009-02-27): make this more general
|
||||
HANDLER(limit_).on(string("#generate"), "actual");
|
||||
|
||||
generate_posts_iterator walker
|
||||
|
|
@ -660,10 +659,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
|
|||
else OPT(related_all);
|
||||
else OPT(revalued);
|
||||
else OPT(revalued_only);
|
||||
#if 0
|
||||
// This option is not available to users
|
||||
else OPT(revalued_total_);
|
||||
#endif
|
||||
break;
|
||||
case 's':
|
||||
OPT(set_account_);
|
||||
|
|
|
|||
|
|
@ -47,8 +47,6 @@ void set_session_context(session_t * session)
|
|||
times_initialize();
|
||||
amount_t::initialize(session->journal->commodity_pool);
|
||||
|
||||
// jww (2009-02-04): Is amount_t the right place for parse_conversion to
|
||||
// happen?
|
||||
amount_t::parse_conversion("1.0m", "60s");
|
||||
amount_t::parse_conversion("1.0h", "60m");
|
||||
|
||||
|
|
|
|||
|
|
@ -82,12 +82,6 @@ value_t report_statistics(call_scope_t& args)
|
|||
|
||||
out << std::endl;
|
||||
|
||||
#if 0
|
||||
out << _(" Number of transactions: ") ;
|
||||
out.width(6);
|
||||
out << statistics.xacts_count << std::endl;
|
||||
#endif
|
||||
|
||||
out << _(" Number of postings: ");
|
||||
out.width(6);
|
||||
out << statistics.posts_count;
|
||||
|
|
|
|||
|
|
@ -323,11 +323,6 @@ void instance_t::read_next_directive()
|
|||
|
||||
case ' ':
|
||||
case '\t': {
|
||||
#if 0
|
||||
char * p = skip_ws(line);
|
||||
if (*p)
|
||||
throw parse_error(_("Line begins with whitespace"));
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -614,15 +609,6 @@ void instance_t::include_directive(char * line)
|
|||
{
|
||||
path filename(line);
|
||||
|
||||
#if 0
|
||||
if (filename[0] != '/' && filename[0] != '\\' && filename[0] != '~') {
|
||||
string::size_type pos = pathname.prev.rfind('/');
|
||||
if (pos == string::npos)
|
||||
pos = pathname.prev.rfind('\\');
|
||||
if (pos != string::npos)
|
||||
filename = string(pathname.prev, 0, pos + 1) + filename;
|
||||
}
|
||||
#endif
|
||||
filename = resolve_path(filename);
|
||||
|
||||
DEBUG("textual.include", "Line " << linenum << ": " <<
|
||||
|
|
@ -652,8 +638,6 @@ void instance_t::account_directive(char * line)
|
|||
|
||||
void instance_t::end_directive(char *)
|
||||
{
|
||||
// jww (2009-02-26): Allow end to be "end account" or "end tag". End by
|
||||
// itself is assumed to be "end account".
|
||||
if (account_stack.empty())
|
||||
throw_(std::runtime_error,
|
||||
_("'end' directive found, but no account currently active"));
|
||||
|
|
@ -758,9 +742,8 @@ void instance_t::general_directive(char * line)
|
|||
break;
|
||||
}
|
||||
|
||||
// jww (2009-02-10): This needs some serious work.
|
||||
scoped_array<char> directive(new char[std::strlen(p) + DIR_PREFIX_LEN + 1]);
|
||||
std::strcpy(directive.get(),DIR_PREFIX);
|
||||
std::strcpy(directive.get(), DIR_PREFIX);
|
||||
std::strcpy(directive.get() + DIR_PREFIX_LEN, p);
|
||||
|
||||
if (expr_t::ptr_op_t op = lookup(directive.get())) {
|
||||
|
|
|
|||
|
|
@ -136,8 +136,6 @@ bool xact_base_t::finalize()
|
|||
// been set.
|
||||
|
||||
if (journal && journal->basket && posts.size() == 1 && ! balance.is_null()) {
|
||||
// jww (2008-07-24): Need to make the rest of the code aware of what to do
|
||||
// when it sees a generated post.
|
||||
null_post = new post_t(journal->basket, ITEM_GENERATED);
|
||||
null_post->_state = (*posts.begin())->_state;
|
||||
add_post(null_post);
|
||||
|
|
@ -459,12 +457,10 @@ bool xact_t::valid() const
|
|||
DEBUG("ledger.validate", "xact_t: ! _date");
|
||||
return false;
|
||||
}
|
||||
#if 0
|
||||
if (! journal) {
|
||||
DEBUG("ledger.validate", "xact_t: ! journal");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
foreach (post_t * post, posts)
|
||||
if (post->xact != this || ! post->valid()) {
|
||||
|
|
|
|||
|
|
@ -263,12 +263,10 @@ class period_xact_t : public xact_base_t
|
|||
}
|
||||
|
||||
virtual bool valid() const {
|
||||
#if 0
|
||||
if (! period.is_valid()) {
|
||||
DEBUG("ledger.validate", "period_xact_t: ! period.is_valid()");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue