Remove aif and awhen

Hopefully we won't be using anaphoric macros in this project
This commit is contained in:
Renaud Casenave-Péré 2015-08-06 18:15:39 +02:00
parent c4b1680d2f
commit 0c4b744e75
2 changed files with 7 additions and 21 deletions

View file

@ -4,8 +4,7 @@
|#
(uiop:define-package :stoe/core/utils
(:export #:it #:aif #:awhen
#:safe-first #:safe-list
(:export #:safe-first #:safe-list
#:group
#:restartable
#:progress-step
@ -18,19 +17,6 @@
#:get-command-line-option-number))
(in-package :stoe/core/utils)
(defmacro aif (test then else)
"Bind the result of evaluating `test' to a variable named `it', as per Paul Graham's On Lisp."
`(let ((it ,test))
(if it
,then
,else)))
(defmacro awhen (test &body body)
"Bind the result of evaluating `test' to a variable named `it', as per Paul Graham's On Lisp."
`(let ((it ,test))
(when it
,@body)))
(defun safe-first (x)
"Return the first element of `x' if it is a list, return `x' otherwise."
(if (listp x) (first x) x))

View file

@ -122,12 +122,12 @@ the forms comprised of these keywords will be printed in comments."
(defun handle-preamble (form)
"Handle a preamble declaration."
(make-var (intern (symbol-name (first form)) :keyword) (glsl-name (first form))
(second form) (cddr form)
(format nil "~@[layout (location = ~a) ~]~@[~(~a~) ~]~(~a~) ~(~a~) ~(~a~);~%"
(awhen (member :location form) (cadr it))
(awhen (member :interp form) (cadr it))
(third form) (second form) (glsl-name (first form)))))
(let ((location (member :location form))
(interp (member :interp form)))
(make-var (intern (symbol-name (first form)) :keyword) (glsl-name (first form))
(second form) (cddr form)
(format nil "~@[layout (location = ~a) ~]~@[~(~a~) ~]~(~a~) ~(~a~) ~(~a~);~%"
location interp (third form) (second form) (glsl-name (first form))))))
(defun glsl-compile (lambda-list body)
"Compile the shader defined in BODY to glsl format.