summaryrefslogtreecommitdiff
path: root/src/scope.h
Commit message (Collapse)AuthorAgeFilesLines
* Report error context in expressions more preciselyJohn Wiegley2010-06-131-5/+11
|
* Fixes to scope.h for the sake of Boost.SerializationJohn Wiegley2010-06-131-2/+21
|
* Completely reworked argument passing in expressionsJohn Wiegley2010-06-131-66/+267
|
* Expression evaluations now have a "type context"John Wiegley2010-06-131-3/+28
| | | | | | | | | Thus, an expression can know if the context in which it's being evaluated requires a string, and if so, determine it's output accordingly. For example: account ; returns the full name of the posting's account account.total ; here the context is SCOPE, so account is an obj
* Untabified all source filesJohn Wiegley2010-06-111-12/+12
|
* Added value_scope_t, for wrapping a value in a scopeJohn Wiegley2010-05-301-0/+24
| | | | | The value expression "value" may be used to extract the wrapped value. This is currently only used by the upcoming --group-title-format option.
* Added more iterator methods to call_scope_tJohn Wiegley2010-05-081-0/+11
|
* Updated copyrights to 2003-2010John Wiegley2010-03-051-1/+1
|
* Very minor but easy optimization for symbol_scope_tJohn Wiegley2009-11-241-1/+1
| | | | | | | Lots of symbol_scope_t throwaway objects get created during value expression calculation, and 99% of them are never used. Therefore, the std::map which each contains is now within an optional<> wrapper, so that no constructor happens unless one is actually used.
* Redesigned the format_t classJohn Wiegley2009-11-091-1/+2
|
* Removed a bunch of empty commentsJohn Wiegley2009-11-081-39/+0
|
* Moved journal reading code into journal_tJohn Wiegley2009-11-051-0/+2
|
* Segregated symbols into 5 separate namespacesJohn Wiegley2009-11-041-15/+78
| | | | | | | | | | | | | | | | | | | | | The different namespaces are: Function Value expression functions, which receive a "context" Option Command-line options Precommand Commands which are invoked before reading the journal Command Commands which are invoked after reading the journal Directive Directives that occur at column 0 in a data file This greatly eases the ability for Python uses to add intercept hooks to change how the basic Ledger module functions. An example of what should be possible soon: import ledger def my_foo_handler(value): print "--foo received:", value ledger.add_handler(ledger.Option, "foo=", my_foo_handler)
* Added value_t::push_frontJohn Wiegley2009-11-041-0/+3
|
* Whitespace fixJohn Wiegley2009-11-041-5/+5
|
* Added missing TRACE_CTOR callsJohn Wiegley2009-11-011-1/+3
|
* Added serialization methods for most typeJohn Wiegley2009-10-301-2/+64
| | | | | This allows journal_t objects to be completed serialized to disk and deserialized.
* Reduced the #include dependency tree to a minimumJohn Wiegley2009-03-041-1/+0
|
* Marked all strings needing internationalizationJohn Wiegley2009-02-251-1/+1
| | | | | | | | | | | | | | | | These strings are now collected automagically in the file po/ledger.pot. If you'd like to produce a translation, just run this command after building Ledger: msginit -l LOCALE -o LANG.po -i po/ledger.pot Where LOCALE is a string like de or en_GB, and LANG is a short descriptive word for your language. Then send me this .po file so I can commit it to the Ledger sources (alternatively, you could maintain the file in a fork on GitHub), and setup the build script to format and install your new message catalog during a "make install".
* Removed some dead codeJohn Wiegley2009-02-241-38/+0
|
* Create a new interactive_t helper classJohn Wiegley2009-02-211-96/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The purpose of this class is much like Emacs' (interactive) form: it allows a value expression function to declare exactly how many arguments, and of what type, it intends to receive. It then offers type-safe access to theese arguments in a consistent manner. An example value expression function definition in C++: value_t fn_foo(call_scope_t& scope) { // We expect a string, an integer, and an optional date interactive_t args(scope, "sl&d"); std::cout << "String = " << args.get<string>(0) << "Integer = " << args.get<long>(1) << std::endl; if (args.has(2)) // was a date provided? std::cout << "Date = " << args.get<date_t>(2) << std::endl; return NULL_VALUE; } There is also an in_context_t<T> template, which finds the context type T in the current scope hierarchy. The in_context_t then also acts as a smart pointer to reference this context object, in addition to serving the same duty as interactive_t. This combination of intent is solely for the sake of brevity. value_t fn_bar(call_scope_t& scope) { in_context_t<account_t> env(scope, "sl&d"); std::cout << "Account name = " << env->fullname() << "String arg = " << env.get<string>(0) << std::endl; return NULL_VALUE; } As you can see here, 'env' acts as a smart pointer to the required context, and an object to extract the typed arguments.
* Added --flat option, to flatten the balance reportJohn Wiegley2009-02-171-0/+9
|
* Fixed several unused value and param warningsJohn Wiegley2009-02-161-1/+1
|
* Moved around some functions for clarityJohn Wiegley2009-02-161-0/+2
|
* Wired up the "entry" command from 2.x, though it still needs to be ported.John Wiegley2009-02-101-0/+7
|
* Added support for value expression definitions.John Wiegley2009-02-081-6/+11
| | | | | | | | Example: ] expr f(x) := x + 100 ] expr f(100) 200
* Allow value expressions to gain access to option settings.John Wiegley2009-02-071-0/+3
| | | | | | | | | | For example, "ledger eval options.limit" prints 0 (for false), but: "ledger -l hello eval options.limit" print "hello"s, since the value of options.limit, once set to a value, is that string. For flag options, such as -Y, eval prints 0 if unset, and 1 if set. This feature allows value expressions to be conditionalized based on the presence of user options.
* Refer to empty expression operators as simply NULL.John Wiegley2009-02-071-1/+1
|
* Largely removed all of Ledger's use of global variables, for the REPL's sake.John Wiegley2009-02-041-17/+60
|
* Fixed some warnings caused by using g++ 4.3.John Wiegley2009-02-021-5/+5
|
* Added documentation stubs for all include files and classes.John Wiegley2009-01-311-0/+44
|
* Stopped using the generic "unsigned int" in favor of more specific types.John Wiegley2009-01-291-6/+6
|
* Increased copyright range to include 2009.John Wiegley2009-01-201-1/+1
|
* Allow var_t<datetime_t>.John Wiegley2009-01-191-0/+9
|
* When setting a scope's argument, convert the list to a sequence if it's notJohn Wiegley2009-01-191-2/+4
| | | | already.
* Corrected the way that scopes are found so that xact_t can also be found as anJohn Wiegley2008-10-291-32/+16
| | | | item_t (which it also is).
* Removed todo comments and dead code.John Wiegley2008-08-171-2/+0
|
* The register report is now mostly displaying multi-line balances correctly.John Wiegley2008-08-101-10/+10
| | | | It still shows lots even when --lots isn't specified, though.
* Regular expressions supplied after 'reg' or 'bal' are working again.John Wiegley2008-08-101-0/+2
|
* Moved around most of the files so that source code is in src/, documentationJohn Wiegley2008-08-051-0/+280
is in doc/, etc.