Index: main/cdk.lisp
===================================================================
--- main/cdk.lisp	(revision main,15)
+++ main/cdk.lisp	(revision main,18)
@@ -1,4 +1,5 @@
 (defpackage #:cdk
-  (:use #:cl #:cffi))
+  (:use #:cl #:cffi)
+  (:export #:with-screen #:with-der-window))
 
 (in-package #:cdk)
@@ -30,4 +31,9 @@
 (defcfun ("endwin" c-end-curses) :int)
 
+(defmacro with-screen ((screen) &body body)
+  `(let ((,screen (c-init-curses-screen)))
+     (unwind-protect (progn ,@body)
+       (c-end-curses))))
+
 (defcfun ("initCDKScreen" c-init-cdk-screen) :pointer
   (curseswindow :pointer))
@@ -68,4 +74,12 @@
 (defcfun ("delwin" c-delete-window) :int
   (window :pointer))
+
+(defmacro with-der-window ((window parent lines columns y x) &body body)
+  `(let ((,window (c-der-window ,parent ,lines ,columns ,y ,x)))
+     (when (null-pointer-p ,window)
+       ;; TODO: Replace this with a condition and a restart.
+       (error "Couldn't create window."))
+     (unwind-protect (progn ,@body)
+       (c-delete-window ,window))))
 
 (defcfun ("box" c-box) :int
