summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* promote compatability with Boost <1.86.0dbear4962024-09-142-18/+28
|
* update to Boost 1.86.0dbear4962024-09-132-8/+8
| | | | fixes #2378
* Avoid string in amount_t::in_place_truncateMax Nikulin2024-08-151-26/+1
| | | | | Do not serialize to string just to get rounded value. `in_place_roundto` should be reliable enough now.
* disable checking for generated transactionsTavis Ormandy2024-08-081-0/+3
| | | | | | | | | There is no parse_context_stack for generated transactions, because they were not parsed from anywhere. This breaks strict checking, because errors can't be reported. It doesn't make sense to report errors for these anyway, so lets just disable them.
* fix use-after-free with regex_match()Tavis Ormandy2024-08-081-4/+4
| | | | | | The smatch does not copy the input, it points to the original. So if the string is on the stack and goes out of scope because it's only used as a parameter, it will just be junk. Make a copy of it at a higher scope.
* Add Python bindings for roundtoMax Nikulin2024-08-073-0/+10
| | | | | | | | | Expose `roundto` and `in_place_roundto` to `Amount`, `Balance`, and `Value` Python classes. They may be handy for debugging. The methods were added after introducing of bindings and likely it is a reason why they were missed. Closes: #2365
* Revert "also copy costs that round to zero"dbear4962024-08-061-1/+1
| | | | | | This reverts commit e2f64be216506b51c029147982f1addc50f4c745. post->cost is actually of type optional, so the cast to bool iscorrect.
* also copy costs that round to zerodbear4962024-08-061-1/+1
|
* copy cost from automatic transaction postingdbear4962024-08-061-0/+2
| | | | fixes #2268
* Avoid ctype abuse.Taylor R Campbell2024-08-0613-47/+76
| | | | | fix https://github.com/ledger/ledger/issues/2338 fix https://github.com/ledger/ledger/issues/2340
* Add new --align-intervals option.Ian20202024-08-067-17/+38
|
* Fix copy on write for amount_t::in_place_roundtoMax Nikulin2024-08-062-9/+2
| | | | | | | | | | | | - Copy amount quantity before rounding. - Fix `amount_t::roundto(int)`. - Transform `balance/testRound` into `balance/testRoundto`. It was a mix of `round` and `roundto` operation with unclear purpose and was relying on `in_place_roundto` behavior modifying all copies. There is no unit tests for balance `round` and `unround` any more. Closes #2362
* Another whitespace changeJohn Wiegley2024-08-051-1/+1
|
* Add whitespace to xact_t::hashJohn Wiegley2024-08-051-0/+8
|
* Rename SHA-512/256 to the more appropriate SHA-512HalfJohn Wiegley2024-08-052-3/+3
|
* Add two missing system headers to sha512.ccJohn Wiegley2024-08-051-0/+2
|
* Revert all changes to sha512.cJohn Wiegley2024-08-051-1/+1
|
* Change one prototypeJohn Wiegley2024-08-051-3/+1
|
* Remove most changes to sha512.ccJohn Wiegley2024-08-051-5/+11
|
* Include sys/types.hJohn Wiegley2024-08-051-0/+1
|
* Include stdint.h in sha512.ccJohn Wiegley2024-08-051-0/+1
|
* Fix return type of SHA512John Wiegley2024-08-051-1/+1
|
* Try something elseJohn Wiegley2024-08-051-7/+1
|
* Revert a type changeJohn Wiegley2024-08-051-2/+2
|
* Type signature fixJohn Wiegley2024-08-051-1/+1
|
* Update src/sha512.ccJohn Wiegley2024-08-051-1/+1
| | | Co-authored-by: Alexis Hildebrandt <afh@surryhill.net>
* Update src/sha512.ccJohn Wiegley2024-08-051-1/+1
| | | Co-authored-by: Alexis Hildebrandt <afh@surryhill.net>
* Add support for --hashes=sha512_256 as another algorithmJohn Wiegley2024-08-0511-26/+35
|
* Make xact hashes independent of posting orderJohn Wiegley2024-08-057-37/+41
| | | | | Also, support matching provided hashes against a prefixed of the generated hash.
* --hashes option requires an argument to specify the algorithmJohn Wiegley2024-08-052-6/+21
| | | | | At the moment only "sha512" or "SHA512" is accepted, but this could extend to more algorithms in the future.
* Add support for hash chaining to detect modifications in postingsJohn Wiegley2024-08-0515-28/+592
| | | | | | | | | | | | | | | | | | | The following details of a posting contribute to its hash: fullname of account string representation of amount Each posting hashes contributes to the transaction hash, which is compromised of: previous transaction’s hash (as encountered in parsing order) actual date optional auxiliary date optional code payee hashes of all postings Note that this means that changes in the “code” or any of the comments
* Fix denominator of roundto resultMax Nikulin2024-08-051-2/+39
| | | | | | | | | | | | | | | | | | Multiprecision rational created from a double value may have large power of 2 denominator since fractional decimal numbers can not be represented as binary floating point numbers. It leads to failed assertion when result is compared to a value converted directly from strings. Use integer multiprecision arithmetics to round numbers to ensure proper denominator. Inspired by python gmpy2 package <https://github.com/aleaxit/gmpy/blob/3e4564ae9d/src/gmpy2_mpq_misc.c#L315> The change makes `roundto` symmetric for positive/negative arguments. Halves are rounded to nearest even. Rounded away from zero are discussed in #1663 and it may be achieved with minimal modification. - See #2329 - Closes #1983
* print: Align amounts even when account names are longGwyneth Morgan2024-07-101-30/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When the account name is longer than the --account-width (default 36), the amounts stop aligning: 2023/01/01 Transaction with long account names Assets:Very:Long:Account:Name:That:Will:Push:The:Amount -10 ABC Assets:Another:Long:Account:Name:That:Will:Push:The:Amount -10 ABC Expenses:Short 20 ABC One can set a larger --account-width, but that is not a great solution for cases where you have only a few accounts with problematically long names. Instead, keep the current account width wherever possible, but when an account name is longer than the account width, account for that and still align the values: 2023/01/01 Transaction with short account names Assets:Short -10 ABC Assets:Short -10 ABC Expenses:Short 20 ABC 2023/01/01 Transaction with long account names Assets:Very:Long:Account:Name:That:Will:Push:The:Amount -10 ABC Assets:Another:Long:Account:Name:That:Will:Push:The:Amount -10 ABC Expenses:Short 20 ABC This is similar to hledger's behavior.
* Fix conditional compilation of Python <3.12 codeAlexis Hildebrandt2024-07-081-4/+3
|
* Fix Python 3.12 deprecation warningAlexis Hildebrandt2024-07-081-3/+18
| | | | | | as "the global configuration variable Py_UnbufferedStdioFlag was deprecated in Python 3.12 and using PyConfig.buffered_stdio is recommended instead." — https://peps.python.org/pep-0741/
* Restore expr context after calc, #2330 #2343Tavis Ormandy2024-07-081-2/+3
| | | | | | | Part of the expr_t::compile() process is to store the current scope, but In post_t::add_to_value that scope is temporary and on the stack. Restore the original context after that process is complete.
* Fix Query Parser for Automated Transactions (#1)Igbanam Ogbuluijah2024-06-252-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add failing test for use case TBH I don't know what I'm doing here, but this seems to fail for the right reasons enough to reflect the parser bug here. * Append to the ident on a closing brace ')' When parsing the automated rule, a scanner reads the line left-to-right char-by-char. The default behaviour is to append the char under the cursor to some `ident` string. When the cursor is on a ')', it skips the default handling and switches into some special handling: it tries to test the string it's reading if it's one of the keywords it knows, to select which type of token just got scanned. If what was scanned is not a known token, it defaults to `token_t::TERM` and returns a new token with the currently accumulated `ident` as a `token_t::TERM`. Issue is, since it skipped the appending to do some custom handling, the `token_t::TERM` will always be without its closing brace. The scanner needs to append the character under the cursor if it's falling through to default processing. * fix test case - ensure proper spacing for the posting to have an amount - ensure the posting balances against an account - the meaning of the number after `->` is the exit code * undo wrong approach * consume_next if unbalanced_braces * how this can be extended
* Fix build with Boost 1.85.0Michael Cho2024-04-251-1/+0
| | | | Signed-off-by: Michael Cho <michael@michaelcho.dev>
* Expand the size of an arbitrary safety limitJohn Wiegley2024-01-191-1/+1
|
* Change an assertion into an if testJohn Wiegley2024-01-191-1/+2
|
* Fix compiler warning about std::binary_functionAlexis Hildebrandt2023-12-123-2/+8
| | | | being deprecated as of C++11
* Fix =regex note query syntaxGwyneth Morgan2023-10-121-0/+4
| | | | | | | | | | | | The manpage documents `=regex` as equivalent to the `note regex` query syntax, but the former does not actually work as the parser only handles an equals sign in the case of `tag type=dining` syntax, and doesn't handle the case where an equals sign starts a note query. Fixing this does break queries like `tag type = dining` with spaces around the equals sign, but that syntax was not intended or documented. Closes: #2275
* include zero-amounts in balance_t::map_sorted_amountsdbear4962023-07-162-2/+5
|
* Merge pull request #2260 from afh/modernize-cmakeAlexis Hildebrandt2023-06-101-3/+3
|\ | | | | cmake: Replace add_defitions with superseding alternatives
| * cmake: Replace add_defitions with superseding alternativesAlexis Hildebrandt2023-06-071-3/+3
| |
* | Merge pull request #2259 from afh/afh-readlineAlexis Hildebrandt2023-06-102-4/+8
|\ \ | | | | | | Improve support for libedit and readline
| * | Add build support readlineAlexis Hildebrandt2023-06-072-4/+8
| |/
* | Merge pull request #2261 from afh/bsd-picAlexis Hildebrandt2023-06-101-0/+2
|\ \ | | | | | | cmake: Add -fPIC to compile flags
| * | cmake: Add -fPIC to compile flagsAlexis Hildebrandt2023-06-071-0/+2
| |/ | | | | | | | | | | when building ledger cli. Fixes #1913
* | Merge pull request #2250 from afh/fix-no-assertAlexis Hildebrandt2023-06-101-1/+2
|\ \ | |/ |/| Fix compilation errors with NO_ASSERT