Skip to content

Commit

Permalink
Updated macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsorokin committed Jun 3, 2013
1 parent 80cad91 commit 9cc2ed8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions observable-macros.lisp
Expand Up @@ -25,15 +25,17 @@
"Define the event trigger. Example:
(deftrigger trigger-node-rect-changed :after ((node rect-node))
(:slot 'rect-changed)
(:documentation ...)) ; optional
(:documentation ...)
(:form ...)) ; optional
"
`(progn
(defgeneric ,name (,sender ,@args)
,@(let ((doc (assoc :documentation specs)))
(if doc (list doc))))
(defmethod ,name ((,sender ,type) ,@args)
,@(if args `((declare (ignore ,@args))))
(values))
,@(if args `((declare (ignorable ,@args))))
,@(let ((form (assoc :form specs)))
(cdr form)))
(defmethod ,name ,qualifier ((,sender ,type) ,@args)
(trigger-event
(slot-value ,sender
Expand Down Expand Up @@ -98,4 +100,5 @@
(setf (slot-value ,name ,slot) ,v)
,@(if midform (list `(funcall ,midform ,v0 ,v))))
,@(if changed-trigger (list `(,changed-trigger ,name)))
,@(if postform (list postform))))))))
,@(if postform (list postform)))
(slot-value ,name ,slot))))))

0 comments on commit 9cc2ed8

Please sign in to comment.