summaryrefslogtreecommitdiffstats
path: root/printf.scm
diff options
context:
space:
mode:
authorJim Pick <jim@jimpick.com>1998-03-08 23:05:22 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
commitb21cac3362022718634f7086964208b2eed8e897 (patch)
tree16f4b2e70645c0e8e2202023170b5a94baa967e3 /printf.scm
parent3796d2595035e192ed4bf1c9a6bfdb13c3c9d261 (diff)
parentf24b9140d6f74804d5599ec225717d38ca443813 (diff)
downloadslib-b21cac3362022718634f7086964208b2eed8e897.tar.gz
slib-b21cac3362022718634f7086964208b2eed8e897.zip
Import Debian changes 2c0-3debian/2c0-3
slib (2c0-3) unstable; urgency=low * New maintainer. * slibconfig script to automatically configure guile. * Fix type in description, closes: Bug#18996 slib (2c0-2) unstable; urgency=low * Minor fix for debian/rules targets slib (2c0-1) unstable; urgency=low * New upstream source * New maintainer
Diffstat (limited to 'printf.scm')
-rw-r--r--printf.scm25
1 files changed, 10 insertions, 15 deletions
diff --git a/printf.scm b/printf.scm
index dffe90d..aefab5c 100644
--- a/printf.scm
+++ b/printf.scm
@@ -56,7 +56,7 @@
(case fc
((#\n #\N) (out #\newline))
((#\t #\T) (out slib:tab))
- ((#\r #\R) (out #\return))
+ ;;((#\r #\R) (out #\return))
((#\f #\F) (out slib:form-feed))
((#\newline) #f)
(else (out fc)))
@@ -85,8 +85,12 @@
(string->number (string c)))))
((not (char-numeric? fc)) accum)
(must-advance)))))))
- (define integer-pad
+ (define integer-convert
(lambda (s radix)
+ (set! s (cond ((symbol? s) (symbol->string s))
+ ((number? s) (number->string s radix))
+ ((or (not s) (null? s)) "0")
+ (else "1")))
(cond ((not (negative? precision))
(set! leading-0s #f)))
(let* ((pre
@@ -216,24 +220,15 @@
(out (make-string (- width (string-length os)) #\ ))
(out os))))
(loop (cdr args)))
-
((#\d #\D #\i #\I #\u #\U)
- (out (integer-pad
- (cond ((symbol? (car args))
- (symbol->string (car args)))
- ((number? (car args))
- (number->string (car args)))
- ((not (car args)) "0")
- (else "1"))
- 10))
+ (out (integer-convert (car args) 10))
(loop (cdr args)))
((#\o #\O)
- (out (integer-pad (number->string (car args) 8) 8))
+ (out (integer-convert (car args) 8))
(loop (cdr args)))
((#\x #\X)
- (out
- ((if (char-upper-case? fc) string-upcase string-downcase)
- (integer-pad (number->string (car args) 16) 16)))
+ (out ((if (char-upper-case? fc) string-upcase string-downcase)
+ (integer-convert (car args) 16)))
(loop (cdr args)))
((#\%) (out #\%)
(loop args))