[standard-reports] reindent/untabify/delete-trailing-whitespace

This commit is contained in:
Christopher Lam 2019-03-02 14:45:19 +08:00
parent d9c8352377
commit 613adfe824

View File

@ -61,14 +61,11 @@
(define (gnc:register-report-hook acct-type split? create-fcn) (define (gnc:register-report-hook acct-type split? create-fcn)
(let ((type-info (hash-ref gnc:*register-report-hash* acct-type))) (let ((type-info (hash-ref gnc:*register-report-hash* acct-type)))
(if (not type-info) (if (not type-info)
(set! type-info (make-acct-type))) (set! type-info (make-acct-type)))
(if split? (if split?
(set-split type-info create-fcn) (set-split type-info create-fcn)
(set-non-split type-info create-fcn)) (set-non-split type-info create-fcn))
(hash-set! gnc:*register-report-hash* acct-type type-info))) (hash-set! gnc:*register-report-hash* acct-type type-info)))
(define (lookup-register-report acct-type split) (define (lookup-register-report acct-type split)
@ -94,30 +91,22 @@
(define (directory-files dir) (define (directory-files dir)
(if (file-exists? dir) (if (file-exists? dir)
(let ((fname-regexp (make-regexp "\\.scm$")) ;; Regexp that matches the desired filenames (let ((fname-regexp (make-regexp "\\.scm$"))
;; Regexp that matches the desired filenames
(dir-stream (opendir dir))) (dir-stream (opendir dir)))
(let loop ((fname (readdir dir-stream)) (let loop ((fname (readdir dir-stream))
(acc '())) (acc '()))
(if (eof-object? fname) (if (eof-object? fname)
(begin (begin
(closedir dir-stream) (closedir dir-stream)
acc acc)
)
(loop (readdir dir-stream) (loop (readdir dir-stream)
(if (regexp-exec fname-regexp fname) (if (regexp-exec fname-regexp fname)
(cons fname acc) (cons fname acc)
acc acc)))))
)
)
)
))
(begin (begin
(gnc:warn "Can't access " dir ".\nEmpty list will be returned.") (gnc:warn "Can't access " dir ".\nEmpty list will be returned.")
'() ;; return empty list '())))
)
)
)
;; Process a list of files by removing the ".scm" suffix if it exists ;; Process a list of files by removing the ".scm" suffix if it exists
;; ;;
@ -127,19 +116,22 @@
;; Return value: ;; Return value:
;; List of files with .scm suffix removed ;; List of files with .scm suffix removed
(define (process-file-list l) (define (process-file-list l)
(map (lambda (s) (if (string-suffix? ".scm" s) (string-drop-right s 4) s)) (map
l (lambda (s)
) (if (string-suffix? ".scm" s)
) (string-drop-right s 4)
s))
l))
;; Return a list of symbols representing reports in the standard reports directory ;; Return a list of symbols representing reports in the standard reports directory
;; ;;
;; Return value: ;; Return value:
;; List of symbols for reports ;; List of symbols for reports
(define (get-report-list) (define (get-report-list)
(map (lambda (s) (string->symbol s)) (map
(process-file-list (directory-files (gnc-path-get-stdreportsdir)))) (lambda (s)
) (string->symbol s))
(process-file-list (directory-files (gnc-path-get-stdreportsdir)))))
(gnc:debug "stdrpt-dir=" (gnc-path-get-stdreportsdir)) (gnc:debug "stdrpt-dir=" (gnc-path-get-stdreportsdir))
(gnc:debug "dir-files=" (directory-files (gnc-path-get-stdreportsdir))) (gnc:debug "dir-files=" (directory-files (gnc-path-get-stdreportsdir)))