*** empty log message ***

This commit is contained in:
John Wiegley 2006-04-05 05:04:50 +00:00
parent 2982e637c2
commit 9ec136db90
6 changed files with 24 additions and 14 deletions

View file

@ -1952,7 +1952,7 @@ void export_amount()
; ;
class_< commodity_base_t::updater_t, commodity_updater_wrap, class_< commodity_base_t::updater_t, commodity_updater_wrap,
boost::noncopyable > boost::noncopyable >
("Updater") ("Updater")
; ;

View file

@ -312,7 +312,7 @@ void parse_conversion(const std::string& larger,
inline bool is_quote_or_paren(char * p) { inline bool is_quote_or_paren(char * p) {
return *p == '"' || *p == '{' || *p == '[' || *p == '('; return *p == '"' || *p == '{' || *p == '[' || *p == '(';
} }
inline char * scan_past_quotes_and_parens(char * expr) inline char * scan_past_quotes_and_parens(char * expr)
{ {

View file

@ -107,7 +107,7 @@ class date_t
char buf[64]; char buf[64];
std::strftime(buf, 63, format.c_str(), localtime()); std::strftime(buf, 63, format.c_str(), localtime());
return buf; return buf;
} }
int year() const { int year() const {
return localtime()->tm_year + 1900; return localtime()->tm_year + 1900;
@ -129,7 +129,7 @@ class date_t
void write(std::ostream& out, void write(std::ostream& out,
const std::string& format = output_format) const { const std::string& format = output_format) const {
out << to_string(format); out << to_string(format);
} }
friend class datetime_t; friend class datetime_t;
friend struct interval_t; friend struct interval_t;
@ -227,9 +227,9 @@ class datetime_t : public date_t
}; };
inline long operator-(const datetime_t& left, const datetime_t& right) { inline long operator-(const datetime_t& left, const datetime_t& right) {
datetime_t temp(left); std::time_t left_time(left);
temp -= right; std::time_t right_time(right);
return temp; return left_time - right_time;
} }
inline datetime_t operator+(const datetime_t& left, const long seconds) { inline datetime_t operator+(const datetime_t& left, const long seconds) {

View file

@ -185,7 +185,8 @@ transaction_t * parse_transaction(char * line, account_t * account,
unsigned long beg = (long)in.tellg(); unsigned long beg = (long)in.tellg();
xact->amount_expr = xact->amount_expr =
parse_amount_expr(in, xact->amount, xact.get()); parse_amount_expr(in, xact->amount, xact.get(),
PARSE_VALEXPR_NO_REDUCE);
unsigned long end = (long)in.tellg(); unsigned long end = (long)in.tellg();
xact->amount_expr.expr = std::string(line, beg, end - beg); xact->amount_expr.expr = std::string(line, beg, end - beg);
@ -492,12 +493,11 @@ bool textual_parser_t::test(std::istream& in) const
} }
static void clock_out_from_timelog(const datetime_t& when, static void clock_out_from_timelog(const datetime_t& when,
account_t * account, account_t * account,
const char * desc, const char * desc,
journal_t * journal) journal_t * journal)
{ {
time_entry_t event; time_entry_t event;
bool found = false;
if (time_entries.size() == 1) { if (time_entries.size() == 1) {
event = time_entries.back(); event = time_entries.back();
@ -511,6 +511,8 @@ static void clock_out_from_timelog(const datetime_t& when,
("When multiple check-ins are active, checking out requires an account"); ("When multiple check-ins are active, checking out requires an account");
} }
else { else {
bool found = false;
for (std::list<time_entry_t>::iterator i = time_entries.begin(); for (std::list<time_entry_t>::iterator i = time_entries.begin();
i != time_entries.end(); i != time_entries.end();
i++) i++)
@ -520,6 +522,7 @@ static void clock_out_from_timelog(const datetime_t& when,
time_entries.erase(i); time_entries.erase(i);
break; break;
} }
if (! found) if (! found)
throw new parse_error throw new parse_error
("Timelog check-out event does not match any current check-ins"); ("Timelog check-out event does not match any current check-ins");

View file

@ -770,8 +770,14 @@ value_expr_t * parse_value_term(std::istream& in, scope_t * scope,
// the current maximum precision displayed. // the current maximum precision displayed.
try { try {
pos = (long)in.tellg(); pos = (long)in.tellg();
temp.parse(in, flags & PARSE_VALEXPR_NO_MIGRATE ?
AMOUNT_PARSE_NO_MIGRATE : 0); unsigned char parse_flags = 0;
if (flags & PARSE_VALEXPR_NO_MIGRATE)
parse_flags |= AMOUNT_PARSE_NO_MIGRATE;
if (flags & PARSE_VALEXPR_NO_REDUCE)
parse_flags |= AMOUNT_PARSE_NO_REDUCE;
temp.parse(in, parse_flags);
} }
catch (amount_error * err) { catch (amount_error * err) {
// If the amount had no commodity, it must be an unambiguous // If the amount had no commodity, it must be an unambiguous

View file

@ -279,6 +279,7 @@ bool compute_amount(value_expr_t * expr, amount_t& amt,
#define PARSE_VALEXPR_PARTIAL 0x01 #define PARSE_VALEXPR_PARTIAL 0x01
#define PARSE_VALEXPR_RELAXED 0x02 #define PARSE_VALEXPR_RELAXED 0x02
#define PARSE_VALEXPR_NO_MIGRATE 0x04 #define PARSE_VALEXPR_NO_MIGRATE 0x04
#define PARSE_VALEXPR_NO_REDUCE 0x08
value_expr_t * parse_value_expr(std::istream& in, value_expr_t * parse_value_expr(std::istream& in,
scope_t * scope = NULL, scope_t * scope = NULL,