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.
Welcome to Ledger
the command-line accounting program
Introduction
============
Ledger is an accounting program which is invoked from the command-line
using a textual ledger file. To start using Ledger, you will need to
create such a file containing your financial transactions. A sample
has been provided in the file "sample.dat". See the documentation
(ledger.pdf, or ledger.info) for full documentation on creating a
ledger file and using Ledger to generate reports.
Once you have such a file -- you might call it "ledger.dat" -- you can
start looking at balances and account registers using commands like
the following:
ledger -f ledger.dat balance assets:checking
ledger -f ledger.dat register expenses:food
This assumes, of course, that like the sample file you use account
names such as "Assets:Checking" and "Expenses:Food". If you use other
account names, you will need to vary the reporting commands you use
accordingly.
Building
========
To build Ledger, you will need a fairly modern C++ compiler (gcc 2.95
will not work), and at least these two libraries installed:
gmp GNU multi-precision library
pcre Perl regular expression library
(On some GNU/Linux systems, the packages you need to install are
called "gmp-dev" and "pcre-dev").
If you wish to read Gnucash data files, you will also need two XML
libraries, which may or may not be available in a single package (it
depends on your distribution):
libexpat, or libxmlparse and libxmltok
Once you have determined where the headers and libraries for the above
packages are installed, run the script "configure", passing those
paths. If you installed everything under /usr/local, you can probably
just type "./configure". Otherwise, do this:
./configure CPPFLAGS=-I<INCLUDE-PATH> LDFLAGS=-L<LIBRARY-PATH>
If you need to specify multiple include or library paths, then do
this:
./configure CPPFLAGS="-I<PATH1> -I<PATH2>" LDFLAGS="-L<PATH1> -L<PATH2>"
Once configure is done running, just type:
make install
Mailing List and IRC
====================
If you need help on how to use Ledger, or run into problems, you can
join the Ledger mailing list at the following Web address:
https://lists.sourceforge.net/lists/listinfo/ledger-discuss
You can also find help at the #ledger channel on the IRC server
irc.freenode.net.