Commit graph

1008 commits

Author SHA1 Message Date
John Wiegley
e4b3f0bb3a The new period parser is passing all tests 2009-11-18 05:45:48 -05:00
John Wiegley
7fe369eb49 The new period parser is implemented, but untested 2009-11-18 04:11:14 -05:00
John Wiegley
fe9af7ace7 Added a "range" member to date_interval_t
This is used to define the beginning/ending ranges of the time period,
before it becomes fixed (by calling stabilize()) and then sets the
values of start and end.
2009-11-18 01:28:01 -05:00
John Wiegley
3e91c3bf2c Added several new types for working with dates and ranges
date_specifier_t ::
    This is like a plain date_t, except it knows what wasn't specified.
    For example, if 2008/06 is parsed, it becomes date_specifier_t which
    knows that no day was given.  If you ask for the begin() date of the
    specifier, it will be 2008/06/01; the end() date (which is
    exclusive) will be 2008/07/01.

  date_range_t ::
    A date range is a range of two specifiers, either of which (but not
    both) may be omitted.  This makes it possible to represent
    expressions like "from june to july", where no day or year is given.
    The exact dates will be inferred by using the current year, and
    fixing the range from YEAR/06/01 to YEAR/07/01.  That is, the range
    goes from the begin() of one date specifier to the begin() of the
    other.

  date_specifier_or_range_t ::
    A variadic type that can be either a date_specifier_t or a
    date_range_t.  It's just a wrapper to represent the fact that ranges
    can be implicit via specifiers (such as, "in june"), or explicit via
    ranges ("since 2008").
2009-11-17 22:23:46 -05:00
John Wiegley
d6cb382b20 Moved date_interval_t::duration_t to date_duration_t 2009-11-17 22:12:17 -05:00
John Wiegley
a866f39210 Added a date_traits_t type 2009-11-17 22:03:32 -05:00
John Wiegley
c28d828d8e Renamed date_interval_t::end to finish 2009-11-17 21:51:51 -05:00
John Wiegley
4bc830a2c5 Some reformatting in query.h 2009-11-17 21:29:33 -05:00
John Wiegley
b06df8533b Added ledger::string(Iter, Iter) constructor 2009-11-17 21:28:56 -05:00
John Wiegley
b2ba07b90c Fixed several time and date duration type uses 2009-11-17 21:28:43 -05:00
John Wiegley
21a9fe108e Made the account and tag directives more rational
Now you must specify "account / end account", and "tag / end tag".  For
backwards compatability, plain "end" is the same as "end account".
2009-11-15 05:49:54 -05:00
John Wiegley
2a411b5c1d Corrected parsing of the 'expr' report query term 2009-11-15 05:49:54 -05:00
John Wiegley
38e165a994 Made the transaction date parser a bit more strict 2009-11-15 05:49:52 -05:00
John Wiegley
20c725df93 Made the amount_t::bigint_t refcount holder 32-bits
It was overflowing on a full register report of just 3M of data.
2009-11-14 06:25:27 -05:00
John Wiegley
cb9991093d Changed a use of balance_error to amount_error 2009-11-14 06:12:10 -05:00
John Wiegley
aa3bade050 Added another catch handler for Python exceptions 2009-11-14 06:11:58 -05:00
John Wiegley
3bec708e38 Fixed an internal reference issue with Python 2009-11-14 06:11:45 -05:00
John Wiegley
d12c7e08c6 Removed post_t::xdata_t::ptr, which is not used 2009-11-14 06:11:18 -05:00
John Wiegley
d89c60f49c Memoize results from the fast predicate matcher
This gains another 15% for the parser, again with a very simple change
that has no impact if the fast predicate matcher fails to work.
2009-11-14 04:29:53 -05:00
John Wiegley
e3064b9520 Spot optimization for simple automated xact exprs
This reduces parsing time in the optimized build by 25%, and was a safe,
easy patch.  If the "quick predicate evaluator" fails, we disable it
from that point on go back to what the standard code does.
2009-11-14 03:45:18 -05:00
John Wiegley
d71f0867f9 Removed the virtual marker on several filter methods 2009-11-14 03:16:44 -05:00
John Wiegley
a461e17eee Added historical support for single-letter valexprs 2009-11-14 03:11:48 -05:00
John Wiegley
7a44791221 Optimization in the formatting of string values 2009-11-14 02:49:38 -05:00
John Wiegley
2d58224001 Break up multiple commodities in equity report 2009-11-14 02:32:49 -05:00
John Wiegley
d76a6a82dc Don't bold the payee for virtual or temporary xacts 2009-11-13 19:00:45 -05:00
John Wiegley
2986bc779e Stylistic change: assert(0) -> assert(false) 2009-11-13 01:48:32 -05:00
John Wiegley
f50ea971ef Fixed some debug output 2009-11-13 01:48:13 -05:00
John Wiegley
e35394a70d --data shouldn't modify the underlying item 2009-11-12 18:23:22 -05:00
John Wiegley
ef3adb5fe0 Move a typedef in utils.h 2009-11-12 15:43:58 -05:00
John Wiegley
49a356f2d2 Added a Journal.collect method to Python
This lets you run standard report queries against a Ledger journal and
get back a collection of postings, for example:

    import ledger

    journal = ledger.Journal("sample.dat")
    posts   = journal.collect("-M assets")
    for post in posts:
        print post.account

However, this code is not really working yet for a large variety of
reasons, having to do with object life-time, shallow copying, and lack
of reference counting where it should be.  For instance, calling
ledger.Journal().collect() fails because the temporary journal object is
destroyed and the collection now has a host of bad pointers.  Using "for
post in journal.collect()" fails too with other bad pointers.  And the
whole lot of it crashes on exit at the moment.
2009-11-12 05:26:06 -05:00
John Wiegley
65ba928a59 Removed unnecessary code 2009-11-12 05:11:09 -05:00
John Wiegley
f217e50ab6 Set call policies for accessing post.xdata.account 2009-11-12 05:11:09 -05:00
John Wiegley
86daa41a90 Added a collect_posts handler 2009-11-12 05:11:09 -05:00
John Wiegley
cd0a040778 Reordered the export_ calls in pyinterp.cc 2009-11-12 05:11:09 -05:00
John Wiegley
9858b4957f Reorganized a bit of the reporting code 2009-11-12 05:11:09 -05:00
John Wiegley
48dc654eda Added has_xdata() methods for journal_t and xact_t 2009-11-12 05:11:06 -05:00
John Wiegley
0068ac8fc0 Made ~post_t virtual 2009-11-12 05:08:43 -05:00
John Wiegley
b2b0ae37e8 session_t now holds a std::auto_prt<journal_t> 2009-11-12 03:32:10 -05:00
John Wiegley
b5dca67396 Moved report normalization into report.cc 2009-11-12 03:31:53 -05:00
John Wiegley
013965d0ce Removed unused code 2009-11-12 01:43:59 -05:00
John Wiegley
c182b7051b Renamed the pricesdb command to pricedb 2009-11-12 01:43:57 -05:00
John Wiegley
95cc364961 Added new value expressions for value conversion
They are:

  to_boolean
  to_int
  to_datetime
  to_date
  to_amount
  to_balance
  to_string
  to_mask
  to_sequence
2009-11-11 21:33:53 -05:00
John Wiegley
b6ff8f19d5 Transactions now verified after applying auto xacts
This way you cannot violate the balancing rules, not even by adding a
stray posting via an automated transaction.
2009-11-11 21:33:07 -05:00
John Wiegley
67c9cf134d Added --date, similar to --account and --payee
This lets you do things like store a date as the value of a tag, then
run:

  ledger --date='has_tag("Foo") ? to_date(tag("Foo")) : date' reg
2009-11-11 21:32:32 -05:00
John Wiegley
c22b8457ef Did away with the "finalizer" abstraction
This was from an earlier time, when it was intended to be used by
Python.  But it's not needed anymore.
2009-11-11 18:29:21 -05:00
John Wiegley
31f85cc803 Use ledger::string only if VERIFY_ON or BOOST_PYTHON 2009-11-11 18:02:47 -05:00
John Wiegley
a8bc4728fe Restore the Doxygen documentation build 2009-11-11 18:02:12 -05:00
John Wiegley
f0f1b0cdfa Value.to_sequence returns a valid Python sequence 2009-11-11 04:46:38 -05:00
John Wiegley
f1b495abfe Added some missing calls to add_post 2009-11-11 04:35:18 -05:00
John Wiegley
dae24c259b Added floor() value expression function 2009-11-11 04:22:41 -05:00