engine-utilities.scm: Add a couple of hashtable functions.

This commit is contained in:
Peter Broadbery 2015-11-12 20:43:58 +00:00
parent cca9cc7c22
commit eb600c79a4
2 changed files with 14 additions and 0 deletions

View File

@ -80,6 +80,18 @@
(+ acct-depth (- (gnc-account-get-tree-depth acct) 1))))
accounts)))
(define (account-assoc acc alist)
(find (lambda (pair) (account-same? acc (car pair))) alist))
(define (account-hash acc size)
(remainder (string-hash (gncAccountGetGUID acc)) size))
(define (account-hashtable-ref table account)
(hashx-ref account-hash account-assoc table account))
(define (account-hashtable-set! table account value)
(hashx-set! account-hash account-assoc table account value))
;; Splits
(export split-same?)
(export split-in-list?)

View File

@ -79,6 +79,8 @@
(export account-full-name<?)
(export account-list-predicate)
(export accounts-get-children-depth)
(export account-hashtable-ref)
(export account-hashtable-set!)
(export split-same?)
(export split-in-list?)