Commit graph

100 commits

Author SHA1 Message Date
John Wiegley
9a9e06554e Formatting now relies exclusively on value expressions.
What this means is that the utility code, basic math, value expressions,
string formatting and option handling are now entirely decoupled from the rest
of the code.  This decoupling not only greatly simplifies the more basic parts
of Ledger, but makes it much easier to test and verify its completeness.

For example, when the formatting code %X is seen by the format parser, it
turns into a call to the expression function fmt_X, which must be defined when
the format string is first compiled against an object.  If that object is a
transaction, the transaction's scope will be the first to have a chance at
providing a definition.  If an account is being reported, it will.  If neither
does, the next scope in sequence -- soon to be the current report -- will, and
then the session object that "owns" the current Ledger session.

In 2.6, the formatting code new everything about transaction and accounts, and
relied on flags to communicate special details between them.  Now the
transaction will offer the details for its own reporting, while the formatter
worries only about strings and how to output them.
2008-08-02 06:42:36 -04:00
John Wiegley
5bf3f536b3 Restored the interval_t time and added a new "period" debugging command.
You can use 'ledger period "daily in june"' to find out how Ledger will parse
that date string, plus up to the first 20 dates it encounters in the range.
Note that the 'end' displayed is currently exclusive.
2008-08-02 00:37:36 -04:00
John Wiegley
858978de89 Journal data structures now use date_t instead of datetime_t.
This means transactions can only have day-level granularity -- which has
always been the case from an data file point of view.  The advantage to this
restriction is that reports will now be immune from daylight savings related
bugs, where a transaction falls to the wrong side of a --monthly report, for
example.
2008-08-01 17:37:22 -04:00
John Wiegley
e5048ec71b Change many uses of for+iterator to use Boost.Foreach. 2008-07-31 17:48:29 -04:00
John Wiegley
99313ebc6c Revised the way that exceptions are thrown around. Instead of context being a
complicated string of pointers, it's now just a global block of text that gets
appended to as the error is being thrown up, and can be displayed at the catch
point if desired.  There are almost no cases where a thrown exception will not
result in an error message being displayed to the user.
2008-07-31 06:24:45 -04:00
John Wiegley
8276b51f56 A new binary_cache_t object has been creating to manage saving and restoring a
Ledger session from a cache file.  It doesn't work at all yet, though at least
the major structures are in place now.
2008-07-31 04:28:58 -04:00
John Wiegley
2aff35215f Enabled a huge number of warning flags for g++ in acprep, and fixed them all
except for several unused parameter warnings (because there is so much code
still #if 0'd out), and one implicit conversion from long long to long which
still has to be dealt with.
2008-07-30 05:12:46 -04:00
John Wiegley
1bb29cdbb7 The register report has begun printing real data, although not all the pieces
are in place yet and the formatting is still off.
2008-07-29 21:44:21 -04:00
John Wiegley
ea27d1b45a Moved around and renamed a very large amount of code in order to rationalize
the way that value expressions extract information from journal objects.
2008-07-29 20:10:03 -04:00
John Wiegley
4518ea9540 Value expression architecture is now rewritten, but the functionality of the
old system (for example, the meaning of 'a') has yet to be restored.  In the
new scheme, this will be done by definition a function outside of the value
expression logic, rather than the tight coupling between journal innards and
value expressions that occurred in 2.x.
2008-07-29 05:59:38 -04:00
John Wiegley
9e9f25b566 'make check' is now working again. Also, conversion from amount_t to/from
double has been disabled, because I am no longer packaging the gdtoa library
with Ledger (because double conversion really has nothing to do with what
Ledger does).  If you wish to use it, you can find gdtoa in cpp-rewrite-2006,
under a sub-directory of the same name.
2008-07-27 01:03:41 -04:00
John Wiegley
713f896790 A large body of work to get the register report printing again, but still
fails due to the fact that 2.x value expression syntax is not restored.
2008-07-27 00:10:35 -04:00
John Wiegley
961b30926b --verify works again, but the memory totals at the end still need work. 2008-07-26 04:08:55 -04:00
John Wiegley
643f2d33cf More work toward getting the textual parser working again. Since this means
that value expressions must work, there are a lot of details involved.
2008-07-24 09:02:47 -04:00
John Wiegley
ac5cc7796f Merged in from master. 2008-07-21 17:34:39 -04:00
John Wiegley
b85e9ba95f Everything but main.cc is compiling again (but with much #if 0'd code). 2008-07-20 06:00:06 -04:00
John Wiegley
20e35aa6f5 I have walked further along the road less compiled by... 2008-07-20 05:32:09 -04:00
John Wiegley
52fc9f2e44 Brought in the final round of 3.0 code, although it does not compile yet:
report, session, parts of xpath, main, journal, option.
2008-07-20 05:03:54 -04:00
John Wiegley
911b866230 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.
2008-07-19 16:52:16 -04:00
John Wiegley
d159501993 The code is compiling again, but it's far from being able to run yet. 2008-05-08 02:50:19 -04:00
John Wiegley
b72236d544 (handle_value): The transaction xdata.dflags were being set too late; the
TRANSACTION_COMPOUND setting was being thrown away as a result.
2008-04-13 05:05:03 -04:00
John Wiegley
5a93d4819e Reworked the way date/times are handled. 2008-04-13 02:41:32 -04:00
John Wiegley
a5aff9eee9 Several fixes to lot price handling. 2008-04-13 02:41:31 -04:00
John Wiegley
44561c1c1d Further refinement of commodity lot information. 2008-04-13 02:41:31 -04:00
John Wiegley
c8ebf53ed8 *** empty log message *** 2008-04-13 02:41:31 -04:00
John Wiegley
32bdfe20d9 Tons of corrections and fixes to value expressions and lot figures. 2008-04-13 02:41:31 -04:00
John Wiegley
9800e3febc *** empty log message *** 2008-04-13 02:41:31 -04:00
John Wiegley
4f83a2bf8f Added new --descend option. 2008-04-13 02:41:30 -04:00
John Wiegley
e32d9e64a7 Added much better error location. 2008-04-13 02:41:29 -04:00
John Wiegley
b737cd8e6d Added a DATETIME value type. 2008-04-13 02:41:29 -04:00
John Wiegley
2ebfddf401 Began support for improved commodity handling. 2008-04-13 02:41:28 -04:00
John Wiegley
96d6d62ad9 Began support for improved commodity handling. 2008-04-13 02:41:28 -04:00
John Wiegley
2930b89ea3 *** empty log message *** 2008-04-13 02:41:27 -04:00
John Wiegley
a597b0fb5e Further improvements to lot pricing. 2008-04-13 02:41:27 -04:00
John Wiegley
7901598f1d Checked in all major updates. 2008-04-13 02:41:27 -04:00
John Wiegley
a8012940f4 Removed Python integration support. 2008-04-13 02:41:21 -04:00
John Wiegley
f691735c6c Restructed the code that it can build and be used as a shared library.
The command-line version is still statically bound in the build
process by default (for the sake of speed).
2008-04-13 02:41:21 -04:00
John Wiegley
eb0525e315 See ChangeLog 2008-04-13 02:41:19 -04:00
John Wiegley
a53f44ecda Support has been added for clearing of individual transactions. Set
`ledger-clear-whole-entries' in Emacs to revert to the old behavior.
2008-04-13 02:41:19 -04:00
John Wiegley
312f0c27e3 (operator): Rearranged some code and added an assert. 2008-04-13 02:41:16 -04:00
John Wiegley
5fb495858b (operator): Rearranged some code and added an assert. 2008-04-13 02:41:16 -04:00
John Wiegley
ed8a236fe6 (subtotal_transactions::operator()): Changed the usage of the
temporary `values' map so that account names are always properly
sorted in the subtotaled output view.  As it was, they were being
reported in account creation order.
2008-04-13 02:41:15 -04:00
John Wiegley
b79b3cf54b (report_budget_items): Removed an unused local variable. 2008-04-13 02:41:15 -04:00
John Wiegley
c8bbbf3f9c (sort_transactions::post_accumulated_xacts): Created this function so
that interval_transactions has a way to post sorted xacts without
calling flush().
2008-04-13 02:41:10 -04:00
John Wiegley
396491c568 (truncate_entries::flush): Fix so that --head and --tail can be used
at the same time.  (export_walk): Added TruncateEntries for Python.
2008-04-13 02:41:01 -04:00
John Wiegley
d0997fa821 Changed truncate_entries so that --head and --tail can be used at the
same time.
2008-04-13 02:41:00 -04:00
John Wiegley
dc4c2b8d50 Added the new transaction handler `truncate_entries' which can be used
to trim a number of entries from the beginning or end of a transction
stream.  (push_to_transactions_list): Removed unneeded "handler"
argument.
2008-04-13 02:41:00 -04:00
John Wiegley
bffa2703fc (clear_transactions_xdata): Clear the transaction xdata pointers once
they have been freed.  (clear_accounts_xdata): Clear the account xdata
pointers once they have been freed.
2008-04-13 02:40:56 -04:00
John Wiegley
9bf398f914 *** empty log message *** 2008-04-13 02:40:55 -04:00
John Wiegley
c4dfcc997c *** empty log message *** 2008-04-13 02:40:55 -04:00