|
|
|
@ -44,6 +44,7 @@
|
|
|
|
|
(t (c) (cons nil c)))))
|
|
|
|
|
(values (car ret) (cdr ret))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defmacro try-catch (try &body catch)
|
|
|
|
|
(let ((errnm (gensym)))
|
|
|
|
|
`(let ((,errnm (handler-case (cons ,try nil)
|
|
|
|
@ -53,12 +54,24 @@
|
|
|
|
|
(values (car ,errnm) (cdr ,errnm))
|
|
|
|
|
(values (car ,errnm) nil)))))
|
|
|
|
|
|
|
|
|
|
(defmacro try (&body body)
|
|
|
|
|
`(try-catch
|
|
|
|
|
(progn
|
|
|
|
|
,@body)
|
|
|
|
|
nil))
|
|
|
|
|
|
|
|
|
|
(defmacro try-catch-finally (try catch &body finally)
|
|
|
|
|
(let ((ret (gensym))
|
|
|
|
|
(err (gensym)))
|
|
|
|
|
`(multiple-value-bind (,ret ,err) (try-catch ,try ,catch)
|
|
|
|
|
(values (progn ,@finally) ,ret ,err))))
|
|
|
|
|
|
|
|
|
|
(defmacro try-finally (try &body finally)
|
|
|
|
|
`(try-catch-finally
|
|
|
|
|
,try
|
|
|
|
|
nil
|
|
|
|
|
,@finally))
|
|
|
|
|
|
|
|
|
|
(defmacro val-if-or (val test or)
|
|
|
|
|
"(if (test val) val or)"
|
|
|
|
|
`(let ((vv ,val))
|
|
|
|
|