aboutsummaryrefslogtreecommitdiff
path: root/scm/extant-input.scm
blob: b06aea63fd7e11030574758c566a6225a53ecc15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(define-module (extant input)
  #:export (register-handler!))

(define *handlers* '())

(define (register-handler! proc)
  (set! *handlers* (cons proc *handlers*)))

(define (dispatch-input text)
  (let loop ((handlers *handlers*))
    (if (null? handlers)
	'((text . "I could not find a suitable handler for this message.")
	  (style . error))
	(let ((result ((car handlers) text)))
	  (if (null? result)
	      (loop (cdr handlers))
	      result)))))