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