Commit | Line | Data |
---|---|---|
a4e6154d DC |
1 | (in-package :lisp-on-lines) |
2 | ||
3 | (defmacro defline (name (specializer &rest layers-and-combination-keywords) &body docstring-and-body) | |
4 | `(progn | |
5 | ,(eval-when | |
6 | (:compile-toplevel :load-toplevel :execute) | |
7 | (unless (fboundp (contextl::get-layered-function-definer-name name)) | |
8 | `(define-layered-function ,name (arg) | |
9 | (:method-combination append)))) | |
10 | (define-layered-method | |
11 | ,name | |
12 | ,@layers-and-combination-keywords | |
13 | ,@(unless | |
14 | (or (third layers-and-combination-keywords) | |
15 | (and layers-and-combination-keywords | |
16 | (null (cdr layers-and-combination-keywords)))) | |
17 | '(APPEND)) | |
18 | (,specializer) | |
19 | ,(when (cdr docstring-and-body) | |
20 | (car docstring-and-body)) | |
21 | ||
22 | ,(or (cdr docstring-and-body) (car docstring-and-body))))) | |
23 | ||
24 | ||
25 | (defun line-out (component object &key (line #'line-in) args) | |
26 | (apply #'display component object (append args (funcall line object)))) | |
27 | ||
28 | (defmacro call-line (from line &rest args) | |
29 | (with-unique-names (lines object) | |
30 | `(multiple-value-bind (,lines ,object) | |
31 | (funcall ,line) | |
32 | (call-display-with-context ,from ,object nil (append ,args ,lines))))) | |
33 |