From: espen Date: Mon, 13 Feb 2006 20:03:29 +0000 (+0000) Subject: Added convenient type GERROR-SIGNAL which will signal an error automatically when... X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/commitdiff_plain/b4a94e209931fdae387a11090159e96e42417fee?ds=sidebyside Added convenient type GERROR-SIGNAL which will signal an error automatically when used as a return type instead of GERROR --- diff --git a/glib/gerror.lisp b/glib/gerror.lisp index eafd9b0..c8cbd23 100644 --- a/glib/gerror.lisp +++ b/glib/gerror.lisp @@ -20,7 +20,7 @@ ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -;; $Id: gerror.lisp,v 1.2 2005-04-23 16:48:50 espen Exp $ +;; $Id: gerror.lisp,v 1.3 2006-02-13 20:03:29 espen Exp $ (in-package "GLIB") @@ -65,6 +65,15 @@ (defun signal-gerror (gerror) (error condition :code (gerror-code gerror) :message (gerror-message gerror)))) +(deftype gerror-signal () 'gerror) + +(defmethod from-alien-form (gerror (type (eql 'gerror-signal)) &rest args) + (declare (ignore type args)) + `(let ((gerror ,(from-alien-form gerror 'gerror))) + (when gerror + (signal-gerror gerror)))) + + ;;; Message logging (eval-when (:compile-toplevel :load-toplevel :execute)