This commit is contained in:
Craig Earls 2014-11-07 18:21:13 -07:00
commit af15887ecb
8 changed files with 50 additions and 26 deletions

View file

@ -87,6 +87,7 @@ check_function_exists(access HAVE_ACCESS)
check_function_exists(realpath HAVE_REALPATH) check_function_exists(realpath HAVE_REALPATH)
check_function_exists(getpwuid HAVE_GETPWUID) check_function_exists(getpwuid HAVE_GETPWUID)
check_function_exists(getpwnam HAVE_GETPWNAM) check_function_exists(getpwnam HAVE_GETPWNAM)
check_function_exists(ioctl HAVE_IOCTL)
check_function_exists(isatty HAVE_ISATTY) check_function_exists(isatty HAVE_ISATTY)
check_c_source_compiles(" check_c_source_compiles("

9
acprep
View file

@ -1,10 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# acprep, version 3.0 # acprep, version 3.1
# #
# This script configures my ledger source tree on my Mac OS/X machine. This
# is not necessary, however, since I keep all the files necessary for building
# checked in to the source tree. Users can just type './configure && make'.
# This script simply sets up the compiler and linker flags for all the various # This script simply sets up the compiler and linker flags for all the various
# build permutations I use for testing and profiling. # build permutations I use for testing and profiling.
@ -802,7 +799,7 @@ class PrepareBuild(CommandLineApp):
conf_args.append('-DCMAKE_CXX_FLAGS=%s' % conf_args.append('-DCMAKE_CXX_FLAGS=%s' %
self.envvars[var]) self.envvars[var])
elif var == 'LDFLAGS': elif var == 'LDFLAGS':
conf_args.append('-DCMAKE_EXE_LINKER_FLAGS=%s' % conf_args.append('-DCMAKE_EXE_LINKER_FLAGS=%s' %
self.envvars[var]) self.envvars[var])
if self.options.boost_root: if self.options.boost_root:
@ -895,7 +892,7 @@ class PrepareBuild(CommandLineApp):
self.log.debug('Changing directory to ' + build_dir) self.log.debug('Changing directory to ' + build_dir)
os.chdir(build_dir) os.chdir(build_dir)
self.execute(*(['ninja' if self.options.use_ninja else 'make'] + self.execute(*(['ninja' if self.options.use_ninja else 'make'] +
make_args)) make_args))
finally: finally:
os.chdir(self.source_dir) os.chdir(self.source_dir)

View file

@ -7,8 +7,7 @@ in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "ledger-3.1.0.${rev}"; name = "ledger-3.1.0.${rev}";
src = builtins.filterSource (path: type: type != "unknown") ./.;
src = ./.;
buildInputs = [ cmake boost gmp mpfr libedit python texinfo gnused ]; buildInputs = [ cmake boost gmp mpfr libedit python texinfo gnused ];
@ -18,7 +17,12 @@ stdenv.mkDerivation {
# broken in ledger... # broken in ledger...
postInstall = '' postInstall = ''
mkdir -p $out/share/emacs/site-lisp/ mkdir -p $out/share/emacs/site-lisp/
cp -v $src/lisp/*.el $out/share/emacs/site-lisp/ cp -v "$src/lisp/"*.el $out/share/emacs/site-lisp/
'' + stdenv.lib.optionalString stdenv.isDarwin ''
for i in date_time filesystem system iostreams regex unit_test_framework; do
boostlib=libboost_''$i.dylib
install_name_tool -change ''$boostlib ${boost}/lib/''$boostlib $out/bin/ledger
done
''; '';
meta = { meta = {

View file

@ -27,6 +27,11 @@ endif()
######################################################################## ########################################################################
# BUILD_WEB_DOCS implies BUILD_DOCS
if (BUILD_WEB_DOCS)
set(BUILD_DOCS 1)
endif()
if (BUILD_DOCS) if (BUILD_DOCS)
find_program(MAKEINFO makeinfo) find_program(MAKEINFO makeinfo)
find_program(TEXI2PDF texi2pdf) find_program(TEXI2PDF texi2pdf)

View file

@ -1756,7 +1756,7 @@ both liquid and commodity assets. Now, on the day of the sale:
@smallexample @c input:validate @smallexample @c input:validate
2005/08/01 Stock sale 2005/08/01 Stock sale
Assets:Broker -50 APPL @{$30.00@} @@ $50.00 Assets:Broker -50 AAPL @{$30.00@} @@ $50.00
Expenses:Broker:Commissions $19.95 Expenses:Broker:Commissions $19.95
Income:Capital Gains $-1,000.00 Income:Capital Gains $-1,000.00
Assets:Broker $2,480.05 Assets:Broker $2,480.05
@ -3325,10 +3325,10 @@ For example, consider the stock sale given above:
@end smallexample @end smallexample
The commodity transferred into @samp{Assets:Brokerage} is not actually 10 The commodity transferred into @samp{Assets:Brokerage} is not actually 10
AAPL, but rather 10 AAPL @{$5.00@}. The figure in braces after the AAPL, but rather 10 AAPL @{$50.00@}. The figure in braces after the
amount is called the ``lot price''. It's Ledger's way of remembering amount is called the ``lot price''. It's Ledger's way of remembering
that this commodity was transferred through an exchange, and that that this commodity was transferred through an exchange, and that
$5.00 was the price of that exchange. $50.00 was the price of that exchange.
This becomes significant if you later sell that commodity again. For This becomes significant if you later sell that commodity again. For
example, you might write this: example, you might write this:
@ -4547,8 +4547,8 @@ Transaction Number,Date,Description,Memo,Amount Debit,Amount Credit,Balance,Chec
Unfortunately, as it stands Ledger cannot read it, but you can. Ledger Unfortunately, as it stands Ledger cannot read it, but you can. Ledger
expects the first line to contain a description of the fields on each expects the first line to contain a description of the fields on each
line of the file. The fields ledger can recognize are called line of the file. The fields ledger can recognize contain these case-insensitive strings
@code{date}, @code{posted}, @code{code}, @code{payee} or @code{desc}, @code{date}, @code{posted}, @code{code}, @code{payee} or @code{desc} or @code{description},
@code{amount}, @code{cost}, @code{total}, and @code{note}. @code{amount}, @code{cost}, @code{total}, and @code{note}.
Delete the account description lines at the top, and replace the first Delete the account description lines at the top, and replace the first
@ -4582,17 +4582,17 @@ transid,date,payee,note,amount,,,code,
@end smallexample @end smallexample
Ledger will include @samp{; transid: 767718} in the first transaction Ledger will include @samp{; transid: 767718} in the first transaction
is from the file above. from the file above.
@findex --invert @findex --invert
@findex --account @var{STR} @findex --account @var{STR}
@findex --rich-data @findex --rich-data
The @command{convert} command accepts three options. The most important The @command{convert} command accepts three options. They are
ones are @option{--invert} which inverts the amount field, and @option{--invert} which inverts the amount field,
@option{--account @var{STR}} which you can use to specify the account to @option{--account @var{STR}} which you can use to specify the account to
balance against and @option{--rich-data}. When using the rich-data balance against, and @option{--rich-data} which stores
switch, additional metadata is stored as tags. There is, for example, additional metadata as tags. There is, for example,
a UUID field. If an entry with the same UUID tag is already included in a UUID field. If an entry with the same UUID tag is already included in
the normal ledger file (specified via @option{--file @var{FILE} (-f)} or the normal ledger file (specified via @option{--file @var{FILE} (-f)} or
via the environment variable @env{LEDGER_FILE}) this entry will not be via the environment variable @env{LEDGER_FILE}) this entry will not be
@ -4613,7 +4613,7 @@ account Aufwand:Einkauf:Lebensmittel
Note that it may be necessary for the output of @samp{ledger convert} Note that it may be necessary for the output of @samp{ledger convert}
to be passed through @code{ledger print} a second time if you want to to be passed through @code{ledger print} a second time if you want to
match on the new payee field. During the @code{ledger convert} run match on the new payee field. During the @code{ledger convert} run,
only the original payee name as specified in the csv data seems to be only the original payee name as specified in the csv data seems to be
used. used.
@ -5239,7 +5239,7 @@ report the values used by each tag.
@findex entry @findex entry
@findex xact @findex xact
The @command{xact} command simplify the creation of new transactions. The @command{xact} command simplifies the creation of new transactions.
It works on the principle that 80% of all postings are variants of It works on the principle that 80% of all postings are variants of
earlier postings. Here's how it works: earlier postings. Here's how it works:
@ -7875,11 +7875,10 @@ A regular expression that matches against a transaction's payee name.
@itemx tag(REGEX) @itemx tag(REGEX)
A regular expression that matches against a transaction's tags. A regular expression that matches against a transaction's tags.
@itemx expr date =~ /REGEX/ @item expr date =~ /REGEX/
Useful for specifying a date in plain terms. For example, you could say Useful for specifying a date in plain terms. For example, you could say
@samp{expr date =~ /2014/}. @samp{expr date =~ /2014/}.
@item expr comment =~ /REGEX/ @item expr comment =~ /REGEX/
A regular expression that matches against a posting's comment field. This A regular expression that matches against a posting's comment field. This
searches only a posting's field, not the transaction's note or comment field. searches only a posting's field, not the transaction's note or comment field.
@ -7935,13 +7934,12 @@ A sub-expression is nested in parenthesis. This can be useful passing
more complicated arguments to functions, or for overriding the natural more complicated arguments to functions, or for overriding the natural
precedence order of operators. precedence order of operators.
@item expr base =~ /REGEX/
@itemx expr base =~ /REGEX/
A regular expression that matches against an account's base name. If A regular expression that matches against an account's base name. If
a posting, this will match against the account affected by the a posting, this will match against the account affected by the
posting. posting.
@itemx expr code =~ /REGEX/ @item expr code =~ /REGEX/
A regular expression that matches against the transaction code (the A regular expression that matches against the transaction code (the
text that occurs between parentheses before the payee). text that occurs between parentheses before the payee).

View file

@ -181,10 +181,17 @@ void report_t::normalize_options(const string& verb)
} }
long cols = 0; long cols = 0;
#if HAVE_IOCTL
struct winsize ws;
#endif
if (HANDLED(columns_)) if (HANDLED(columns_))
cols = lexical_cast<long>(HANDLER(columns_).value); cols = lexical_cast<long>(HANDLER(columns_).value);
else if (const char * columns = std::getenv("COLUMNS")) else if (const char * columns = std::getenv("COLUMNS"))
cols = lexical_cast<long>(columns); cols = lexical_cast<long>(columns);
#if HAVE_IOCTL
else if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1)
cols = ws.ws_col;
#endif
else else
cols = 80L; cols = 80L;

View file

@ -145,10 +145,17 @@ value_t select_command(call_scope_t& args)
string thus_far = ""; string thus_far = "";
std::size_t cols = 0; std::size_t cols = 0;
#if HAVE_IOCTL
struct winsize ws;
#endif
if (report.HANDLED(columns_)) if (report.HANDLED(columns_))
cols = lexical_cast<std::size_t>(report.HANDLER(columns_).value); cols = lexical_cast<std::size_t>(report.HANDLER(columns_).value);
else if (const char * columns_env = std::getenv("COLUMNS")) else if (const char * columns_env = std::getenv("COLUMNS"))
cols = lexical_cast<std::size_t>(columns_env); cols = lexical_cast<std::size_t>(columns_env);
#if HAVE_IOCTL
else if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1)
cols = ws.ws_col;
#endif
else else
cols = 80; cols = 80;

View file

@ -63,6 +63,7 @@
#define HAVE_REALPATH @HAVE_REALPATH@ #define HAVE_REALPATH @HAVE_REALPATH@
#define HAVE_GETPWUID @HAVE_GETPWUID@ #define HAVE_GETPWUID @HAVE_GETPWUID@
#define HAVE_GETPWNAM @HAVE_GETPWNAM@ #define HAVE_GETPWNAM @HAVE_GETPWNAM@
#define HAVE_IOCTL @HAVE_IOCTL@
#define HAVE_ISATTY @HAVE_ISATTY@ #define HAVE_ISATTY @HAVE_ISATTY@
#define HAVE_UNIX_PIPES @HAVE_UNIX_PIPES@ #define HAVE_UNIX_PIPES @HAVE_UNIX_PIPES@
@ -151,6 +152,10 @@ typedef std::ostream::pos_type ostream_pos_type;
#include <pwd.h> #include <pwd.h>
#endif #endif
#if HAVE_IOCTL
#include <sys/ioctl.h>
#endif
#if HAVE_UNIX_PIPES #if HAVE_UNIX_PIPES
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>