*** empty log message ***

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2092 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-03-19 23:46:52 +00:00
parent 97d248f32f
commit cd329e1944
10 changed files with 277 additions and 233 deletions

View File

@ -1,7 +1,7 @@
How to install gnucash-1.3.0 on SuSE-6.3
========================================
(written 2000-01-07 by Peter Pointner <peter@wuzel.m.isar.de>)
(changed for gnucash-1.3.0 2000-03-01 by Herbert Thoma (tma@iis.fhg.de))
(changed for gnucash-1.3.x 2000-03-01 by Herbert Thoma (tma@iis.fhg.de))
Notes:
@ -13,6 +13,8 @@ Notes:
- This is definitely for SuSE 6.3 (Intel). Earlier SuSE distributions
lack some required packages. Later SuSE distributions didn't exist
at the time of writing.
NOTE: You can install new packages to older versions of SuSE from
CD or ftp.suse.de or ftp.suse.com
Let's go:
@ -22,7 +24,7 @@ Let's go:
* Install the following packages:
+ from series d
eperl guile nana swig xmhtml xmhtmld
eperl guile nana swig xmhtml xmhtmld gettext
and optionally
autoconf automake libtool
(You must install libtool if you have autoconf/automake
@ -33,6 +35,8 @@ Let's go:
lesstiff lesstifd
+ from series gnm
gnlibs gnlibsd
+ from series gra
imlib imlibdev
* Download slib from
ftp://ftp.gnu.org/pub/gnu/jacal/slib2c7.zip
@ -58,3 +62,6 @@ Let's go:
make gnome for gnome version (recommended) or
make qt for qt/KDE version (pre alpha, may even not compile)
su root -c "make install"
* You may need to run GnuCash once as root, because guile needs to set up
some things for slib.

View File

@ -17,7 +17,6 @@
(gnc:depend "doc.scm")
(gnc:depend "extensions.scm")
(gnc:depend "text-export.scm")
; (gnc:depend "importqif.scm")
(gnc:depend "report.scm")
(gnc:depend "report/report-list.scm")

View File

@ -22,6 +22,7 @@
(#t
(list-set! old-map 5 new-descript)))))
;; the account-display is a 3-columned list of accounts in the QIF
;; import dialog (the "Account" page of the notebook). Column 1 is
;; the account name in the QIF file, column 2 is the number of QIF
@ -151,13 +152,13 @@
;; sort by number of transactions with that account so the
;; most important are at the top
; (set! retval (sort-list retval
; (lambda (a b)
; (or
; (> (list-ref a 4) (list-ref b 4))
; (and
; (eq? (list-ref a 4) (list-ref b 4))
; (string<? (car a) (car b)))))))
(set! retval (sort retval
(lambda (a b)
(or
(> (list-ref a 4) (list-ref b 4))
(and
(eq? (list-ref a 4) (list-ref b 4))
(string<? (car a) (car b)))))))
retval))
@ -234,13 +235,13 @@
;; sort by number of transactions with that account so the
;; most important are at the top
; (set! retval (sort-list retval
; (lambda (a b)
; (or
; (> (list-ref a 4) (list-ref b 4))
; (and
; (eq? (list-ref a 4) (list-ref b 4))
; (string<? (car a) (car b)))))))
(set! retval (sort retval
(lambda (a b)
(or
(> (list-ref a 4) (list-ref b 4))
(and
(eq? (list-ref a 4) (list-ref b 4))
(string<? (car a) (car b)))))))
retval))
@ -261,4 +262,3 @@
#f
file))
list-of-files)))

View File

@ -62,12 +62,12 @@
((eq? qstate-type 'type:cat)
(set! current-xtn (make-qif-cat)))
((eq? qstate-type 'account)
(set! current-xtn (make-qif-acct)))
(#t
(display "qif-file:read-file can't handle ")
(write qstate-type)
(display " transactions yet.")
(newline))))
(set! current-xtn (make-qif-acct)))))
; (#t
; (display "qif-file:read-file can't handle ")
; (write qstate-type)
; (display " transactions yet.")
; (newline))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; account transactions
@ -140,7 +140,7 @@
;; O : adjustment (stock transactions)
((#\O)
(qif-xtn:set-adjustment!
current-xtn (qif-file:parse-value self value)))
current-xtn (qif-file:parse-value/decimal self value)))
;; L : category
((#\L)
@ -167,7 +167,9 @@
;; what the $ signifies. I'll do it later.
(if (not (eq? qstate-type 'type:invst))
(qif-split:set-amount!
current-split (qif-file:parse-value self value))))
current-split
(qif-file:parse-value/decimal self value))))
;; ^ : end-of-record
((#\^)
(if (and (qif-xtn:date current-xtn)
@ -240,12 +242,8 @@
(set! first-xtn #f)
(set! current-xtn (make-qif-xtn))
(set! default-split (make-qif-split)))
(set! default-split (make-qif-split)))))
(else
(display "qif-file:read-file : unknown Bank slot ")
(display tag)
(newline))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Class transactions
@ -265,7 +263,6 @@
;; end-of-record
((#\^)
(qif-file:add-class! self current-xtn)
; (qif-class:print current-xtn)
(set! current-xtn (make-qif-class)))
(else
@ -290,7 +287,7 @@
((#\L)
(qif-acct:set-limit!
current-xtn (qif-file:parse-value self value)))
current-xtn (qif-file:parse-value/decimal self value)))
((#\^)
(qif-file:add-account! self current-xtn)
@ -304,6 +301,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Category (Cat) transactions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
((eq? qstate-type 'type:cat)
(case tag
;; N : category name
@ -333,12 +331,12 @@
;; seems to be an integer)
((#\R)
(qif-cat:set-tax-rate!
current-xtn (qif-file:parse-value self value)))
current-xtn (qif-file:parse-value/decimal self value)))
;; B : budget amount. not really supported.
((#\B)
(qif-cat:set-budget-amt!
current-xtn (qif-file:parse-value self value)))
current-xtn (qif-file:parse-value/decimal self value)))
;; end-of-record
((#\^)
@ -350,7 +348,7 @@
(display "qif-file:read-file : unknown Cat slot ")
(display tag) (newline))))
;; trying to sneak on by, eh?
;; trying to sneak one by, eh?
(#t
(if (not qstate-type)
(begin
@ -396,21 +394,37 @@
self (qif-file:path-to-accountname self)))
;; reparse values and dates if we figured out the format.
(let ((reparse-ok #t))
(for-each
(lambda (xtn)
(qif-xtn:reparse xtn self))
(set! reparse-ok
(and reparse-ok (qif-xtn:reparse xtn self))))
(qif-file:xtns self))
(if (not reparse-ok)
(begin
(display "xtn reparse failed") (newline)))
(for-each
(lambda (cat)
(qif-cat:reparse cat self))
(set! reparse-ok
(and reparse-ok (qif-cat:reparse cat self))))
(qif-file:cats self))
(if (not reparse-ok)
(begin
(display "cat reparse failed") (newline)))
(for-each
(lambda (acct)
(qif-acct:reparse acct self))
(set! reparse-ok
(and reparse-ok (qif-acct:reparse acct self))))
(qif-file:accounts self))
#t)
(if (not reparse-ok)
(begin
(display "acct reparse failed") (newline)))
reparse-ok))
(begin
(display "There was a heinous error. Failed to read file.")
(newline)

View File

@ -7,6 +7,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:support "qif-import.scm")
(gnc:depend "simple-obj.scm")
(gnc:depend "qif-objects.scm") ;; class definitions
(gnc:depend "qif-parse.scm") ;; string-to-value, date parsing
@ -15,3 +16,5 @@
(gnc:depend "qif-dialog-utils.scm") ;; build displays for dialog
(gnc:depend "qif-guess-map.scm") ;; build QIF->gnc acct mappings
(gnc:depend "qif-to-gnc.scm") ;; conv QIF xtns/acct to GNC xtns/acct

View File

@ -9,6 +9,7 @@
(gnc:support "qif-objects.scm")
(gnc:depend "simple-obj.scm")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; qif-file class
;; radix-format : one of 'decimal 'comma or 'unspecified
@ -301,6 +302,7 @@
self))
(define (qif-xtn:reparse self qif-file)
(let ((reparse-ok #t))
;; share price
(if (string? (qif-xtn:share-price self))
(qif-xtn:set-share-price!
@ -319,20 +321,32 @@
self
(qif-file:parse-value qif-file (qif-xtn:adjustment self))))
(if (or (string? (qif-xtn:share-price self))
(string? (qif-xtn:num-shares self))
(string? (qif-xtn:adjustment self)))
(set! reparse-ok #f))
;; reparse the amount of each split
(for-each
(lambda (split)
(if (string? (qif-split:amount split))
(qif-split:set-amount!
split
(qif-file:parse-value qif-file (qif-split:amount split)))))
(qif-file:parse-value qif-file (qif-split:amount split))))
(if (string? (qif-split:amount split))
(set! reparse-ok #f)))
(qif-xtn:splits self))
;; reparse the date
(if (string? (qif-xtn:date self))
(qif-xtn:set-date! self
(qif-file:parse-date qif-file
(qif-xtn:date self)))))
(qif-xtn:date self))))
(if (string? (qif-xtn:date self))
(set! reparse-ok #f))
reparse-ok))
(define (qif-xtn:print self)
(simple-obj-print self <qif-xtn>))
@ -386,7 +400,11 @@
(define (qif-acct:reparse self file)
(if (string? (qif-acct:limit self))
(qif-acct:set-limit!
self (qif-file:parse-value file (qif-acct:limit self)))))
self (qif-file:parse-value file (qif-acct:limit self))))
(if (or (string? (qif-acct:limit self))
(string? (qif-acct:type self)))
#f
#t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -496,7 +514,11 @@
(if (string? (qif-cat:budget-amt self))
(qif-cat:set-budget-amt!
self (qif-file:parse-value file (qif-cat:budget-amt self)))))
self (qif-file:parse-value file (qif-cat:budget-amt self))))
(if (or (string? (qif-cat:tax-rate self))
(string? (qif-cat:budget-amt self)))
#f #t))
(define (qif-file:add-xtn! self xtn)

View File

@ -126,7 +126,13 @@
GNC-ASSET-TYPE)
((string=? mangled-string "oth l")
GNC-LIABILITY-TYPE)
(#t read-value))))
((string=? mangled-string "mutual")
GNC-MUTUAL-TYPE)
(#t
(display "qif-file:parse-acct-type : unhandled account type ")
(display read-value)
(display "... substituting Bank.")
GNC-BANK-TYPE))))
(define (qif-file:state-to-account-type self qstate)
(cond ((eq? qstate 'type:bank)
@ -349,29 +355,53 @@
(string-remove-leading-space (string-remove-trailing-space str)))
(define decimal-radix-regexp
(make-regexp
"^-?[0-9]+$|^-?[0-9]?[0-9]?[0-9]?(,[0-9][0-9][0-9])*(\\.[0-9]*)?$"))
(define comma-radix-regexp
(make-regexp
"^-?[0-9]+$|^-?[0-9]?[0-9]?[0-9]?(\\.[0-9][0-9][0-9])*(,[0-9]*)?$"))
(define (value-is-decimal-radix? value)
(if (regexp-exec decimal-radix-regexp value)
#t #f))
(define (value-is-comma-radix? value)
(if (regexp-exec comma-radix-regexp value)
#t #f))
(define (qif-file:parse-value/decimal self value-string)
(+ 0.0
(with-input-from-string (string-remove-char value-string #\,)
(lambda () (read)))))
(define (qif-file:parse-value/comma self value-string)
(+ 0.0
(with-input-from-string
(string-replace-char! (string-remove-char value-string #\.)
#\, #\.)
(lambda () (read)))))
(define (qif-file:parse-value self value-string)
(if (or (not (string? value-string))
(not (> (string-length value-string) 0)))
(set! value-string "0"))
(set! value-string "0")
(set! value-string (string-remove-leading-space
(string-remove-trailing-space value-string))))
(let ((comma-index (string-rindex value-string #\,))
(decimal-index (string-rindex value-string #\.))
(comma-count (string-char-count value-string #\,))
(decimal-count (string-char-count value-string #\.)))
;; if we don't know the radix format, it might be appropriate to
;; guess. guessed radix format doesn't affect parsing at all
;; until you set the radix-format from the guessed-radix-format
;; and call reparse-values on all the values.
(let ((possibly-comma-radix? (value-is-comma-radix? value-string))
(possibly-decimal-radix? (value-is-decimal-radix? value-string)))
(if (and (eq? (qif-file:radix-format self) 'unknown)
(not (eq? (qif-file:guessed-radix-format self) 'inconsistent)))
(cond
;; already think it's decimal
((eq? (qif-file:guessed-radix-format self) 'decimal)
(if (or (> decimal-count 1)
(and decimal-index comma-index
(> comma-index decimal-index)))
(if (and possibly-comma-radix?
(not possibly-decimal-radix?))
(begin
(qif-file:set-guessed-radix-format! self 'inconsistent)
(display "this QIF file has inconsistent radix notation!")
@ -379,9 +409,8 @@
;; already think it's comma
((eq? (qif-file:guessed-radix-format self) 'comma)
(if (or (> comma-count 1)
(and decimal-index comma-index
(> decimal-index comma-index)))
(if (and possibly-decimal-radix?
(not possibly-comma-radix?))
(begin
(qif-file:set-guessed-radix-format! self 'inconsistent)
(display "this QIF file has inconsistent radix notation!")
@ -389,86 +418,29 @@
;; don't know : look for numbers that are giveaways.
((eq? (qif-file:guessed-radix-format self) 'unknown)
;; case 1: there's a decimal and a comma, and the
;; decimal is to the right of the comma, and there's
;; only one decimal : it's a decimal number.
(if (and decimal-index comma-index
(> decimal-index comma-index)
(eq? decimal-count 1))
(cond ((and possibly-decimal-radix?
(not possibly-comma-radix?))
(qif-file:set-guessed-radix-format! self 'decimal))
;; case 2: the opposite.
(if (and decimal-index comma-index
(> comma-index decimal-index)
(eq? comma-count 1))
(qif-file:set-guessed-radix-format! self 'comma))
;; case 3: there's no decimal and more than one comma:
;; it's a decimal number. I wish I had more transactions
;; like this!
(if (and (eq? decimal-count 0)
(> comma-count 1))
(qif-file:set-guessed-radix-format! self 'decimal))
;; case 4: the opposite (no comma, multiple decimals)
(if (and (eq? comma-count 0)
(> decimal-count 1))
(qif-file:set-guessed-radix-format! self 'comma))
;; case 5: one decimal, no commas, and not-3 digits
;; after it --> decimal.
(if (and (eq? comma-count 0)
(eq? decimal-count 1)
(not (eq? (- (string-length value-string)
decimal-index)
4)))
(qif-file:set-guessed-radix-format! self 'decimal))
;; case 6: the opposite --> comma
(if (and (eq? comma-count 1)
(eq? decimal-count 0)
(not (eq? (- (string-length value-string)
comma-index)
4)))
(begin
(display "hey!") (display comma-count)
(display comma-index) (display (string-length value-string))
(newline)
((and possibly-comma-radix?
(not possibly-decimal-radix?))
(qif-file:set-guessed-radix-format! self 'comma))))))
(cond
;; decimal radix (US format)
;; number can't have more than one ., and the rightmost
;; . must be to the right of the rightmost ,
;; , are ignored otherwise
((eq? 'decimal (qif-file:radix-format self))
(if (or (and decimal-count
(> decimal-count 1))
(and decimal-index comma-index
(> comma-index decimal-index)))
(error "badly-formed decimal-radix number" value-string)
(+ 0.0
(with-input-from-string (string-remove-char value-string #\,)
(lambda () (read))))))
;; comma radix (German format)
;; number can't have more than one , and the rightmost
;; , must be to the right of the rightmost .
;; . are ignored otherwise. Substitute . for , before
;; parsing.
((eq? 'comma (qif-file:radix-format self))
(if (or (and comma-count
(> comma-count 1))
(and decimal-index comma-index
(> decimal-index comma-index)))
(error "badly formed comma-radix number" value-string)
(+ 0.0
(with-input-from-string (string-replace-char!
(string-remove-char value-string #\.)
#\, #\.)
(lambda () (read))))))
;; unknown radix - store the string and we can process it
;; later.
((eq? (qif-file:radix-format self) 'decimal)
(if possibly-decimal-radix?
(qif-file:parse-value/decimal self value-string)
(begin
(display "Format is decimal-radix, but number is")
(write value-string)
(newline)
0.0)))
((eq? (qif-file:radix-format self) 'comma)
(if possibly-comma-radix?
(qif-file:parse-value/comma self value-string)
(begin
(display "Format is comma-radix, but number is")
(write value-string)
(newline)
0.0)))
(#t
value-string))))

View File

@ -241,6 +241,8 @@
(define (qif-import:qif-xtn-to-gnc-xtn qif-xtn qif-file gnc-xtn
gnc-acct-hash mapping-data)
(let ((splits (qif-xtn:splits qif-xtn))
(gnc-near-split (gnc:split-create))
(near-split-total 0)
(qif-cat-map (caddr mapping-data))
(qif-acct-map (cadr mapping-data))
(near-acct-info #f)
@ -257,19 +259,37 @@
;; find the GNC account for the near end of the transaction
;; (all splits have the same near end)
(if (qif-xtn:bank-xtn? qif-xtn)
(begin
(set! near-acct-info
(hash-ref qif-acct-map
(if (qif-xtn:bank-xtn? qif-xtn)
(qif-file:account qif-file)
(qif-xtn:security-name qif-xtn))))
(set! near-acct-name (list-ref near-acct-info 1))
(set! near-acct (hash-ref gnc-acct-hash near-acct-name))
(qif-file:account qif-file)))
(set! near-acct-name
(list-ref near-acct-info 1))
(set! near-acct (hash-ref gnc-acct-hash near-acct-name)))
(begin
(set! near-acct-info
(hash-ref qif-acct-map
(qif-xtn:security-name qif-xtn)))
(set! near-acct-name
(list-ref near-acct-info 1))
(set! near-acct (hash-ref gnc-acct-hash near-acct-name))))
(if (qif-split:memo (car (qif-xtn:splits qif-xtn)))
(gnc:split-set-memo gnc-near-split
(qif-split:memo (car (qif-xtn:splits qif-xtn)))))
(let ((cleared (qif-xtn:cleared qif-xtn)))
(cond ((eq? 'cleared cleared)
(gnc:split-set-reconcile gnc-near-split #\c))
((eq? 'reconciled cleared)
(gnc:split-set-reconcile gnc-near-split #\r))))
;; iterate over QIF splits
(for-each
(lambda (qif-split)
(let ((gnc-near-split (gnc:split-create))
(gnc-far-split (gnc:split-create))
(let ((gnc-far-split (gnc:split-create))
(far-acct-info #f)
(far-acct-name #f)
(far-acct-type #f)
@ -281,19 +301,13 @@
;; fill the splits in (near first). This handles files in
;; multiple currencies by pulling the currency value from the
;; file import.
(if split-amt
(begin
(gnc:split-set-base-value gnc-near-split
split-amt
currency)
(set! near-split-total
(+ near-split-total split-amt))
(gnc:split-set-base-value gnc-far-split
(- split-amt)
currency))
(error "No amount in split!" qif-split "txn:" qif-xtn))
(- split-amt) currency)
(if memo
(begin
(gnc:split-set-memo gnc-near-split memo)
(gnc:split-set-memo gnc-far-split memo)))
;; my guess is that you can't have Quicken splits
@ -355,14 +369,24 @@
(list-ref far-acct-info 1))
(set! far-acct (hash-ref gnc-acct-hash far-acct-name))))
;; finally, plug the splits into the accounts
(gnc:transaction-append-split gnc-xtn gnc-near-split)
(gnc:transaction-append-split gnc-xtn gnc-far-split)
(gnc:account-insert-split near-acct gnc-near-split)
(gnc:account-insert-split far-acct gnc-far-split)))
;; set the reconcile status
(let ((cleared (qif-xtn:cleared qif-xtn)))
(cond ((eq? 'cleared cleared)
(gnc:split-set-reconcile gnc-far-split #\c))
((eq? 'reconciled cleared)
(gnc:split-set-reconcile gnc-far-split #\r))))
;; finally, plug the splits into the accounts
(gnc:transaction-append-split gnc-xtn gnc-far-split)
(gnc:account-insert-split far-acct gnc-far-split)))
splits)
(gnc:split-set-base-value gnc-near-split
near-split-total
(qif-file:currency qif-file))
(gnc:transaction-append-split gnc-xtn gnc-near-split)
(gnc:account-insert-split near-acct gnc-near-split)
;; return the modified transaction (though it's ignored).
gnc-xtn))

View File

@ -38,7 +38,10 @@
"")))
(define (string-remove-char str char)
(let ((rexpstr (make-string 1 char)))
(let ((rexpstr
(if (not (eq? char #\.))
(make-string 1 char)
"\\.")))
(regexp-substitute/global #f rexpstr str 'pre 'post)))
(define (string-char-count str char)
@ -46,7 +49,10 @@
(string->list str))))
(define (string-replace-char! str old new)
(let ((rexpstr (make-string 1 old))
(let ((rexpstr
(if (not (eq? old #\.))
(make-string 1 old)
"\\."))
(newstr (make-string 1 new)))
(regexp-substitute/global #f rexpstr str 'pre newstr 'post)))
@ -62,3 +68,4 @@
(loop first-char))
(set! parts (cons (substring str 0 last-char) parts))))
parts))

View File

@ -515,7 +515,3 @@
budget-list)
(html-end-table)
(html-end-document))))))