mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* src/scm/utilities.scm (flatten): improved via grib's version.
* src/scm/text-export.scm: use srfis as modules. * src/scm/main.scm: use srfis as modules. * src/scm/date-utilities.scm: use srfi-19 as a module. * src/scm/Makefile.am (SUBDIRS): remove srfi. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4211 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
cdc836b728
commit
94e55b4fd0
@ -1,5 +1,5 @@
|
||||
|
||||
SUBDIRS = gnumeric printing qif-import report srfi
|
||||
SUBDIRS = gnumeric printing qif-import report
|
||||
|
||||
gncscmdir = ${GNC_SCM_INSTALL_DIR}
|
||||
|
||||
|
@ -19,8 +19,9 @@
|
||||
;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652
|
||||
;; Boston, MA 02111-1307, USA gnu@gnu.org
|
||||
|
||||
(use-modules (srfi srfi-19))
|
||||
|
||||
(gnc:support "date-utilities.scm")
|
||||
(gnc:depend "srfi/srfi-19.scm")
|
||||
|
||||
(define gnc:reldate-list '())
|
||||
|
||||
|
@ -15,6 +15,11 @@
|
||||
;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652
|
||||
;; Boston, MA 02111-1307, USA gnu@gnu.org
|
||||
|
||||
;; Load the srfis (eventually, we should see where these are needed
|
||||
;; and only have the use-modules statements in those files).
|
||||
(use-modules (srfi srfi-1))
|
||||
(use-modules (srfi srfi-8))
|
||||
|
||||
;; A list of things to do when in batch mode after the initial
|
||||
;; startup. List items may be strings, in wich case they're read and
|
||||
;; evaluated or procedures, in which case they're just executed.
|
||||
@ -28,11 +33,6 @@
|
||||
|
||||
(gnc:setup-debugging)
|
||||
|
||||
;; Load the srfis
|
||||
(gnc:load "srfi/srfi-8.guile.scm")
|
||||
(gnc:load "srfi/srfi-1.unclear.scm")
|
||||
(gnc:load "srfi/srfi-1.r5rs.scm")
|
||||
|
||||
;; Now we can load a bunch of files.
|
||||
(gnc:depend "doc.scm")
|
||||
(gnc:depend "extensions.scm")
|
||||
|
@ -17,11 +17,12 @@
|
||||
;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652
|
||||
;; Boston, MA 02111-1307, USA gnu@gnu.org
|
||||
|
||||
(use-modules (srfi srfi-1))
|
||||
|
||||
(gnc:support "text-export.scm")
|
||||
|
||||
(require 'pretty-print)
|
||||
(gnc:depend "engine-utilities.scm")
|
||||
(gnc:depend "srfi-1.scm")
|
||||
|
||||
;; TODO
|
||||
;;
|
||||
|
@ -110,20 +110,20 @@ string and 'directories' must be a list of strings."
|
||||
(filter values lst))
|
||||
|
||||
(define (flatten tree)
|
||||
;; This is ugly, but efficient -- leaves nothing pending on the
|
||||
;; stack, and doesn't build intermediate results that it throws
|
||||
;; away.
|
||||
(define result '())
|
||||
(define (flatten-sub-tree tree)
|
||||
(cond
|
||||
((null? tree) #t)
|
||||
((list? tree)
|
||||
(flatten-sub-tree (car tree))
|
||||
(flatten-sub-tree (cdr tree)))
|
||||
(else
|
||||
(set! result (cons tree result)))))
|
||||
(flatten-sub-tree tree)
|
||||
(reverse! result))
|
||||
;; This leaves nothing pending on the stack, and doesn't build
|
||||
;; intermediate results that it throws away.
|
||||
(define (flatten-element elt)
|
||||
(if (list? elt)
|
||||
(flatten-a-list elt)
|
||||
(set! result (cons elt result))))
|
||||
(define (flatten-a-list lst)
|
||||
(for-each flatten-element lst))
|
||||
|
||||
(if (list? tree)
|
||||
(begin
|
||||
(flatten-a-list tree)
|
||||
(reverse! result))
|
||||
tree))
|
||||
|
||||
(define (striptrailingwhitespace line)
|
||||
(substring line 0 (let loop ((pos (- (string-length line) 1)))
|
||||
|
Loading…
Reference in New Issue
Block a user