;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.projectional-editor) ;;;;;;; ;;; Reader API (def (generic e) read-from-device (document device) (:documentation "Reads an operation in the context of DOCUMENT from a single DEVICE. Has side effects on DEVICE.")) (def (namespace e) reader) (def (definer e) reader (name arguments &body forms) `(setf (find-reader ',name) (lambda ,arguments ,@forms))) ;;;;;; ;;; Reader API implementation (def method read-from-device (object (device device/output)) ;; NOTE: continue if DEVICE is also an input device, otherwise do nothing (if (input-device? device) (call-next-method) (values)))