aboutsummaryrefslogtreecommitdiffstats
path: root/charplot.scm
diff options
context:
space:
mode:
authorThomas Bushnell, BSG <tb@debian.org>2005-11-02 14:55:21 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:32 -0800
commit34c54a22ff7818bb8b38ef4d9c87dbbcb221ba73 (patch)
tree1189d06a81277bcf8539b0260a69a19f6038effb /charplot.scm
parent611b3db17894e5fdc0db3d49eaf6743d27b44233 (diff)
parent5145dd3aa0c02c9fc496d1432fc4410674206e1d (diff)
downloadslib-34c54a22ff7818bb8b38ef4d9c87dbbcb221ba73.tar.gz
slib-34c54a22ff7818bb8b38ef4d9c87dbbcb221ba73.zip
Import Debian changes 3a2-1debian/3a2-1
slib (3a2-1) unstable; urgency=low * New upstream release. * Acknowledge NMU. (Closes: #281809) * Makefile: Don't hack Makefile; use rules instead. * debian/rules: Set on make invocations: prefix, htmldir, TEXI2HTML. * debian/rules (clean): Clean more stuff here. * Makefile: Comment out old rule for $(htmldir)slib_toc.html. Instead, specify directly that the texi2html invocation produces that file. * debian/rules (binary-indep): Find web files in slib subdir. * debian/control (Build-Depends-Indep): Go back to using scm.
Diffstat (limited to 'charplot.scm')
-rw-r--r--charplot.scm27
1 files changed, 16 insertions, 11 deletions
diff --git a/charplot.scm b/charplot.scm
index 890fca0..31d0fea 100644
--- a/charplot.scm
+++ b/charplot.scm
@@ -85,7 +85,7 @@
(output-port-height (current-output-port))))
(width (or (and charplot:dimensions (cadr charplot:dimensions))
(output-port-width (current-output-port)))))
- (define pra (create-array " " height width))
+ (define pra (make-array " " height width))
;;Put newlines on right edge
(do ((idx (+ -1 height) (+ -1 idx)))
((negative? idx))
@@ -166,20 +166,24 @@
(define (charplot:array->list ra)
(define dims (array-dimensions ra))
- (do ((idx (+ -1 (car dims)) (+ -1 idx))
- (cols '() (cons (do ((jdx (+ -1 (cadr dims)) (+ -1 jdx))
- (row '() (cons (array-ref ra idx jdx) row)))
- ((negative? jdx) row))
- cols)))
- ((negative? idx) cols)))
+ (if (= 2 (length dims))
+ (do ((idx (+ -1 (car dims)) (+ -1 idx))
+ (cols '() (cons (do ((jdx (+ -1 (cadr dims)) (+ -1 jdx))
+ (row '() (cons (array-ref ra idx jdx) row)))
+ ((negative? jdx) row))
+ cols)))
+ ((negative? idx) cols))
+ (do ((idx (+ -1 (car dims)) (+ -1 idx))
+ (cols '() (cons (array-ref ra idx) cols)))
+ ((negative? idx) cols))))
;;;Converts data to list of coordinates (list).
(define (charplot:data->lists data)
(cond ((array? data)
(case (array-rank data)
((1) (set! data (map list
- (let ((ra (apply create-array '#()
- (array-shape data))))
+ (let ((ra (apply make-array '#()
+ (array-dimensions data))))
(array-index-map! ra identity)
(charplot:array->list ra))
(charplot:array->list data))))
@@ -279,12 +283,13 @@
data)
(array-for-each write-char pra)
(if (not (eqv? #\newline (apply array-ref pra
- (map cadr (array-shape pra)))))
+ (map (lambda (x) (+ -1 x))
+ (array-dimensions pra)))))
(newline))))
(define (charplot:plot-function func vlo vhi . npts)
(set! npts (if (null? npts) 64 (car npts)))
- (let ((dats (create-array (Ar64) npts 2)))
+ (let ((dats (make-array (A:floR64b) npts 2)))
(array-index-map! (make-shared-array dats (lambda (idx) (list idx 0)) npts)
(lambda (idx)
(+ vlo (* (- vhi vlo) (/ idx (+ -1 npts))))))