Move middleware utils to the middleware module
author |
Steve Losh <steve@stevelosh.com> |
date |
Sat, 05 Dec 2015 20:35:38 +0000 |
parents |
15af562c7bca
|
children |
d5962bdd9186
|
branches/tags |
(none) |
files |
src/middleware/core.lisp src/utils.lisp |
Changes
--- a/src/middleware/core.lisp Sat Dec 05 20:27:18 2015 +0000
+++ b/src/middleware/core.lisp Sat Dec 05 20:35:38 2015 +0000
@@ -2,3 +2,15 @@
(defvar *middleware* (fset:empty-map))
+
+(defmacro handle-op (message op fallback &rest body)
+ `(if (equal ,op (fset:lookup ,message "op"))
+ (progn ,@body)
+ (funcall ,fallback ,message)))
+
+(defmacro define-middleware (name op message-binding &rest body)
+ (let ((fallback (gensym)))
+ `(defun ,name (,fallback)
+ (lambda (,message-binding)
+ (handle-op ,message-binding ,op ,fallback
+ ,@body)))))
--- a/src/utils.lisp Sat Dec 05 20:27:18 2015 +0000
+++ b/src/utils.lisp Sat Dec 05 20:35:38 2015 +0000
@@ -97,14 +97,3 @@
"id" (fset:lookup message "id")
"session" (fset:lookup message "session"))))
-(defmacro handle-op (message op fallback &rest body)
- `(if (equal ,op (fset:lookup ,message "op"))
- (progn ,@body)
- (funcall ,fallback ,message)))
-
-(defmacro define-middleware (name op message-binding &rest body)
- (let ((fallback (gensym)))
- `(defun ,name (,fallback)
- (lambda (,message-binding)
- (handle-op ,message-binding ,op ,fallback
- ,@body)))))