summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Change a use of is_realzero to just is_zeroJohn Wiegley2023-03-27
| | | | This is needed to avoid a possible divide by zero.
* Increase string size limit in src/unistring.h assertJohn Wiegley2023-03-27
|
* Do not perform commodity reduction when parsing a format directiveJohn Wiegley2023-03-03
|
* Enforce use of non-deprecated boost::filesystem APIAlexis Hildebrandt2023-02-20
| | | | For details see https://www.boost.org/doc/libs/1_81_0/libs/filesystem/doc/deprecated.html
* Fix compiler warningsAlexis Hildebrandt2023-02-20
| | | | minimizing use of deprecated API where possible.
* Remove unused server related codeAlexis Hildebrandt2023-02-20
|
* Add info about compile features to --versionAlexis Hildebrandt2023-02-14
|
* When a post has no date at all, default to the current dateJohn Wiegley2023-02-06
|
* Update copyright yearAlexis Hildebrandt2023-02-02
| | | | [skip ci]
* Fix deprecation warningsAlexis Hildebrandt2023-02-01
| | | | Code clean-up
* Remove support for Python 2.xAlexis Hildebrandt2023-02-01
|
* If the amount-width has not been set, use the old default of 20John Wiegley2023-01-27
|
* Use amount_width for balance reportVladimir Parfinenko2023-01-27
|
* Fix python/c++ conversion for boost::optional<T>David Sklar2023-01-27
| | | | | | | | | | | | | | Setters for types wrapped in boost::optional, such as item_t::note were broken, e.g. setting a note on a transaction resulted in garbled data that would cause Python to throw utf-8 errors when retrieving the note. (But setters that accessed strings directly, e.g. "payee" on a transaction worked fine.) This change alters the from-python conversion for optional-wrapped types based on the example at https://stackoverflow.com/questions/36485840/wrap-boostoptional-using-boostpython and a test case to verify the behavior.
* Fix IDENT format comment to match recent change 35713fe79Donald Lam2023-01-27
|
* Disallow numbers in function namesJohn Wiegley2023-01-25
|
* Rename quoted_rfc4180 to quoted_rfc, to avoid parser quirkDonald Lam2023-01-25
| | | | | | | Ledger's expression parser considers quoted_rfc4180 to be an amount (quantity 4180 of commodity "quoted_rfc"). Fixes #2007.
* typo and column alignmentspaette2023-01-23
|
* Initial fix for #2147WY2023-01-20
|
* Python: Transaction.remove_post should call xact_base_t::remove_postDavid Sklar2023-01-10
|
* Python: test cleanupsDavid Sklar2023-01-09
| | | | | | | | 1. Remove references to modules (exceptions, StringIO) no longer needed for Pythn3 2. Use assertEqual instead of assertEquals 3. Clear journal files with a close_journal_files() function that uses the then-current underlying python_session pointer. Calling session.close_journal_files() sometimes leads to segfaults because python_session has changed after it was injected into the python module (as "session") on module startup.
* Add python support for error_contextAdam Wendt2022-11-13
| | | | | | Added ledger.session.error_context() to py_session.cc to get the error context message when exceptions are thrown.
* Fix balancing commodity with smaller unit.Maria2022-10-11
|
* xml: Include posting-specific payee in outputGwyneth Morgan2022-10-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In `ledger xml` export, include the `<posting>`-specific payee (from the `Payee:` tag) as `<payee>`. This data is already included under `<metadata>` as `<value key="Payee">`, but that is more specific to Ledger's implementation; if in the future there is another way to set the payee (or perhaps an option to have the Payee tag in one's own language), that field wouldn't be a reliable method of getting this info. Example: 2022-01-01 Transaction-level payee a 10 b ; Payee: Posting-level payee Relevant XML output: <transaction> <date>2022-01-01</date> <payee>Transaction-level payee</payee> <postings> <posting> <account ref="0000558defd6f260"> <name>a</name> </account> <post-amount> <amount> <quantity>10</quantity> </amount> </post-amount> <total> <amount> <quantity>10</quantity> </amount> </total> </posting> <posting> <payee>Posting-level payee</payee> <account ref="0000558defd6f960"> <name>b</name> </account> <post-amount> <amount> <quantity>-10</quantity> </amount> </post-amount> <note> Payee: Posting-level payee</note> <metadata> <value key="Payee"> <string>Posting-level payee</string> </value> </metadata> <total> <amount> <quantity>0</quantity> </amount> </total> </posting> </postings> </transaction>
* Handle return value of PyUnicode_READYAlexis Hildebrandt2022-10-02
| | | | | | to ensure access macros are only called on "legacy" unicode string objects that are "ready". See https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_READY
* Fix handling of UCS-2 encoded stringsAlexis Hildebrandt2022-10-02
| | | | | | Add test to python/demo.py Fixes #2132
* Fix handling of UCS-1 encoded stringsAlexis Hildebrandt2022-10-02
| | | | Add test to python/demo.py
* Properly handle PyUnicode_1BYTE_DATAAlexis Hildebrandt2022-07-20
|
* Fix use of deprecated Python legacy Unicode APIAlexis Hildebrandt2022-07-20
| | | | | | | | replacing it with APIs introduced in Python 3.3 to ensure ledger's Python bindings continue to function when the legacy Unicode API is removed in Python 3.12. For details see https://docs.python.org/3.10/c-api/unicode.html
* Fix typos found by codespellAlexis Hildebrandt2022-07-19
|
* Fix SIGABRT when python subcommand raises an exceptionAaron L. Zeng2022-07-13
| | | | | | | | | | | | | Before, `ledger python -- -c 'raise RuntimeError'` would terminate messily via SIGABRT, printing the following: terminate called after throwing an instance of 'int' [1] 2151711 abort (core dumped) ledger python -c 'raise RuntimeError' This change makes the python subcommand throw a standard C++ exception rather than just a plain int, which is never caught and triggers the SIGABRT. Now, the process prints the uncaught Python exception as usual and then exits with exit code 1.
* Update copyright statement for 2022Alexis Hildebrandt2022-07-02
|
* Fix unrounding for equityOleg Bulatov2022-05-06
|
* When calculating balance assignments, strip away lot annotationsJohn Wiegley2022-05-03
|
* Remove some UTF-8 code that was having no effectkanreki2022-04-14
| | | | Fixes #2061.
* Change header guard names to use `INCLUDED_` prefixPhil Newton2022-04-06
| | | | Fixes #2049
* Avoid making references to nullKunht Kun2022-03-17
| | | | | | | | | | | | | | | | | | | | | | | | | | In `compare_items` if `sort_order` is a top level expression, it has no context and `get_context()` method returns the null pointer. To see this, run $ ledger -f test/input/demo.ledger --sort display_amount reg --debug scope.symbols and there will be many lines like [DEBUG] Binding scope 0 with ... In such case making a reference to the context is an undefined behavior (honestly the dereferencing itself feels quite problematic, but many compilers just run without any complaints) and could potentially cause segfaults. Therefore, we change to use only the grandchild scope (`left` or `right`) for `find_sort_values` here. Note that it may seem to be more appropriate to use `report` here for the parent scope. However, in `find_sort_values` which is called right after, the `report` scope is always bound to this scope. So we only use grandchild scope to avoid unnecessary operations. Fixes #2069.
* Avoid dereferencing null pointerKunht Kun2022-03-12
| | | | | | | Here `comm` could be a null pointer (the new test regress/2057 shows such a case). So test it before dereferencing to avoid segfault. Re: #2057
* Ensure absolute path for includeKunht Kun2022-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure the path of file to include in `instance_t::include_directive` is always an absolute path. Previously when the journal file is given through stdin, we prepend a "./" to the filename to include. However, in Boost >= 1.77, `path::normalize` strips the leading "./" [1]. Our `resolve_path` function calls `normalize` and thus now it returns "file" for "./file" instead of the previous "./file". This change causes a failing test regress/BF3C1F82-2 [2], and also breaks the `include` directive for stdin input: $ touch file-to-include $ echo "include file-to-include" | ledger -f - reg gives While parsing file "", line 1: Error: File to include was not found: "file-to-include" Therefore, we change to prepend the `context.current_directory` to make the filename absolute in this case as well. The test regress/BF3C1F82-2 is also updated to match the new output. Fixes #2075. [1] https://github.com/boostorg/filesystem/commit/16bd89b7c0398d0dc5904148a865ef3fc3ece7ec [2] https://github.com/ledger/ledger/issues/2075
* fileinfo_t: remove size memberMaximilian Eschenbacher2022-02-22
| | | | | | | | | | | it is currently not required but set. Incidentally, calling file_size() on a bash pipe e.g. /proc/self/fd/11 fails with: Error: boost::filesystem::file_size: Operation not permitted: "/proc/self/fd/11" when executing ledger as ledger -f <(cat journal)
* Revert "Use amount_width for balance report"John Wiegley2022-02-03
| | | | This reverts commit 7baa0efd71896711e563feb957926433f529d892.
* Use amount_width for balance reportVladimir Parfinenko2022-02-03
|
* check that commodity format uses correct symbolChristopher Zimmermann2022-02-03
| | | | closes 1948
* Revert "Revert "Revert "Change --invert to invert displayed amounts and ↵John Wiegley2022-02-03
| | | | | | totals, not amounts""" This reverts commit c99a4b03320242d3d5a6d64f73f8581fe5ea2306.
* Revert "Revert "Revert "Compare price annotations using their textual ↵John Wiegley2022-02-03
| | | | | | rendering""" This reverts commit bc45e0205d23f5a8f2e3e389195daa85f4b07ec0.
* Revert "Revert "Compare price annotations using their textual rendering""John Wiegley2022-02-03
| | | | This reverts commit 7f78cadea4a2359f1f53ce9c0c66b6d3fafd81c4.
* Revert "Revert "Change --invert to invert displayed amounts and totals, not ↵John Wiegley2022-02-03
| | | | | | amounts"" This reverts commit 1600ee1f64f659b151c1c873d478baa1bdab89f2.
* Use correct int return type for stream input operationskanreki2021-12-08
| | | | | | | | This makes it safe to compare results to -1 to indicate EOF, regardless of whether char is considered signed or unsigned; and so eliminates compiler warnings on platforms such as ARM. Fixes bug #2058.
* Fix --time-colon for negative time amountsRafael Ascensão2021-09-27
| | | | | | | | | | | | | | | While the current formula works for positive numbers, negative numbers are incorrectly represented. One of the issues comes from the fact that floor(x) < x for every x. `amount_t precision` will always be a non negative number and the code that attempts to fix the issue for negative number will never run. If we truncate the number instead, the current formula works for both positive and negative numbers without making negative numbers a corner case. So let's do that. Signed-off-by: Rafael Ascensão <rafa.almas@gmail.com>
* Fix silent errors when reading lines from input files.Austin Wise2021-08-24
| | | | | | | | Handle files that don't end with a new line. Throw an error when the buffer size is exceeded. Fixes #516 Contributes to #1149