(files "terrain")
(import ()
burst-string read-line write-string ->namestring
- error:wrong-type-argument flo:= flo:>= flo:flonum? symbol-name
- guarantee-list-of-type->length guarantee-symbol guarantee-string
+ error:wrong-type-argument real? ->flonum symbol-name
+ guarantee-list-of-type->length
universal-time->local-time-string
- sleep-current-thread
define-class define-method initialize-instance
system-global-environment
define-syntax syntax-rules outf-error ill-formed-syntax
+ flo:abs flo:round->exact
fix:+ fix:* fix:- fix:-1+ fix:1+ fix:=)
(import (gtk)
gtk-widget-set-hexpand
(define (check-flonum-args num description)
(if (not (= num (guarantee-list-of-type->length
- args flo:flonum? "a flonum" 'TERRAIN)))
+ args real? "a real number" 'TERRAIN)))
(error (string-append
"The "(symbol-name command)" command requires"
(number->string num '(int))" arguments: "description"."))))
(cond
((eq? 'POSITION command)
(check-flonum-args 3 "LATITUDE, LONGITUDE and ALTITUDE")
- (let ((lat (car args))
- (lng (cadr args))
- (alt (caddr args)))
+ (let ((lat (->flonum (car args)))
+ (lng (->flonum (cadr args)))
+ (alt (->flonum (caddr args))))
(if (not (flo:<= (flo:abs lat) 80.))
(error "Requested latitude is greater than 80°:" lat))
(let ((pos (glx-viewport-position widget))
((eq? 'HEADING command)
(check-flonum-args 1 "AZIMUTH")
- (set-glx-viewport-heading! widget (degrees->radians (car args)))
+ (set-glx-viewport-heading! widget
+ (degrees->radians (->flonum (car args))))
(gtk-widget-queue-draw widget))
((eq? 'TILT command)
(check-flonum-args 1 "INCLINATION in degrees")
- (if (not (flo:<= (flo:abs (car args)) 80.))
+ (if (not (flo:<= (flo:abs (->flonum (car args))) 80.))
(error "Requested inclination greater than 80°.")
(set-glx-viewport-tilt! widget (degrees->radians (car args))))
(gtk-widget-queue-draw widget))