r18786 - gnucash/trunk/src/engine - Replace and-let* in scheme script so that srfi-2 isn't needed.
Christian Stimming
cstim at code.gnucash.org
Tue Mar 2 16:23:52 EST 2010
Author: cstim
Date: 2010-03-02 16:23:52 -0500 (Tue, 02 Mar 2010)
New Revision: 18786
Trac: http://svn.gnucash.org/trac/changeset/18786
Modified:
gnucash/trunk/src/engine/iso-currencies-to-c
Log:
Replace and-let* in scheme script so that srfi-2 isn't needed.
Modified: gnucash/trunk/src/engine/iso-currencies-to-c
===================================================================
--- gnucash/trunk/src/engine/iso-currencies-to-c 2010-03-02 21:04:29 UTC (rev 18785)
+++ gnucash/trunk/src/engine/iso-currencies-to-c 2010-03-02 21:23:52 UTC (rev 18786)
@@ -2,7 +2,6 @@
exec guile -s $0 "$@"
!#
-(use-modules (srfi srfi-2))
(use-modules (ice-9 slib))
;; Test for simple-format
(if (not (defined? 'simple-format))
@@ -15,27 +14,31 @@
(define *c-file-name* "iso-4217-currencies.c")
(define (generate-currency-c-code form output-port)
- (or (and-let* (((list? form))
- ((eq? 8 (length form)))
- (fullname (list-ref form 0))
- (unitname (list-ref form 1))
- (partname (list-ref form 2))
- (namespace (list-ref form 3))
- (mnemonic (list-ref form 4))
- (exchange-code (list-ref form 5))
- (parts-per-unit (list-ref form 6))
- (smallest-fraction (list-ref form 7))
- ((string? fullname))
- ((string? unitname))
- ((string? partname))
- ((string? namespace))
- ((string? mnemonic))
- ((string? exchange-code))
- ((number? parts-per-unit))
- ((number? smallest-fraction)))
-
- (format
- output-port "
+ ;; Check for correct number of arguments
+ (if (and (list? form)
+ (eq? 8 (length form)))
+ ;; Assign arguments
+ (let ((fullname (list-ref form 0))
+ (unitname (list-ref form 1))
+ (partname (list-ref form 2))
+ (namespace (list-ref form 3))
+ (mnemonic (list-ref form 4))
+ (exchange-code (list-ref form 5))
+ (parts-per-unit (list-ref form 6))
+ (smallest-fraction (list-ref form 7)))
+ ;; Check for correct types of arguments
+ (if (and (string? fullname)
+ (string? unitname)
+ (string? partname)
+ (string? namespace)
+ (string? mnemonic)
+ (string? exchange-code)
+ (number? parts-per-unit)
+ (number? smallest-fraction))
+
+ ;; And print the output line
+ (format
+ output-port "
{
const char *fullname = ~S;
gnc_commodity *c = gnc_commodity_new(book,
@@ -52,12 +55,19 @@
}
}
}\n"
- fullname
- namespace
- mnemonic
- exchange-code
- smallest-fraction))
+ fullname
+ namespace
+ mnemonic
+ exchange-code
+ smallest-fraction)
+ ;; Sorry, code doubling of the error message, but whatever.
+ (begin
+ (display "Bad currency data at form: ")
+ (display form)
+ (newline)
+ #f)))
+
(begin
(display "Bad currency data at form: ")
(display form)
More information about the gnucash-changes
mailing list