[standard-reports] modernise to srfi-9 records

This commit is contained in:
Christopher Lam 2019-08-22 18:54:59 +08:00
parent 53b7cba11e
commit 123033e5ea

View File

@ -25,6 +25,7 @@
(define-module (gnucash report standard-reports))
(use-modules (srfi srfi-9))
(use-modules (srfi srfi-13))
(use-modules (gnucash utilities))
(use-modules (gnucash core-utils))
@ -39,26 +40,15 @@
;; or without split. If no function is found, then run the 'default'
;; function
(define acct-type-info (make-record-type "AcctTypeInfo" '(split non-split)))
(define make-acct-type-private
(record-constructor acct-type-info '(split non-split)))
(define-record-type :acct-type-info
(make-acct-type-private split non-split)
acct-type-info?
(split get-split set-split)
(non-split get-non-split set-non-split))
(define (make-acct-type)
(make-acct-type-private #f #f))
(define get-split
(record-accessor acct-type-info 'split))
(define set-split
(record-modifier acct-type-info 'split))
(define get-non-split
(record-accessor acct-type-info 'non-split))
(define set-non-split
(record-modifier acct-type-info 'non-split))
(define (gnc:register-report-hook acct-type split? create-fcn)
(let ((type-info (hash-ref gnc:*register-report-hash* acct-type (make-acct-type))))
(if split?