Index: main/cdk.lisp
===================================================================
--- main/cdk.lisp	(revision main,6)
+++ main/cdk.lisp	(revision main,7)
@@ -50,4 +50,18 @@
   (x :int))
 
+(defcfun ("subwin" c-sub-window) :pointer
+  (orig :pointer)
+  (lines :int)
+  (columns :int)
+  (y :int)
+  (x :int))
+
+(defcfun ("derwin" c-der-window) :pointer
+  (orig :pointer)
+  (lines :int)
+  (columns :int)
+  (y :int)
+  (x :int))
+
 (defcfun ("delwin" c-delete-window) :int
   (window :pointer))
@@ -57,4 +71,70 @@
   (vertical-ch chtype)
   (horizontal-ch chtype))
+
+(defcfun ("wborder" c-window-border) :int
+  (window :pointer)
+  (ls chtype)
+  (rs chtype)
+  (ts chtype)
+  (bs chtype)
+  (tl chtype)
+  (tr chtype)
+  (bl chtype)
+  (br chtype))
+
+(defcfun ("wbkgd" c-set-window-background) :int
+  (window :pointer)
+  (ch chtype))
+
+(defcfun ("werase" c-erase-window) :int
+  (window :pointer))
+
+(defcfun ("mvwadd_wch" c-move-and-add-char) :int
+  (window :pointer)
+  (y :int)
+  (x :int)
+  (wch :pointer))
+
+(defcstruct cchar_t
+  (attr chtype)
+  (char :uint32 :count 5))
+
+
+
+(defcvar ("_nc_wacs" nc-wacs) :pointer :read-only t)
+
+(defun wacs-char (ch)
+  (let ((code (char-code (ecase ch
+                           (:ul-corner #\l)
+                           (:ll-corner #\m)
+                           (:ur-corner #\k)
+                           (:lr-corner #\j)
+                           (:r-tee #\u)
+                           (:l-tee #\t)
+                           (:b-tee #\v)
+                           (:t-tee #\w)
+                           (:h-line #\q)
+                           (:v-line #\x)
+                           (:plus #\n)))))
+    (inc-pointer nc-wacs (* (foreign-type-size 'cchar_t) code))))
+
+(defun move-and-add-char (window y x ch)
+  (with-foreign-object (s 'cchar_t)
+    (with-foreign-slots ((attr char) s cchar_t)
+      (setf attr 0)
+      (dotimes (i 5)
+        (setf (mem-aref char :uint32 i) 0))
+      (setf (mem-aref char :uint32) (char-code ch)))
+    (c-move-and-add-char window y x s)))
+
+(defun move-and-add-string (window y x s)
+  (dotimes (i (length s))
+    (move-and-add-char window y (+ x i) (aref s i))))
+
+(defcfun ("wrefresh" c-refresh-window) :int
+  (window :pointer))
+
+(defun color-pair (n)
+  (* 256 n))
 
 
@@ -149,2 +229,25 @@
   (entry :pointer)
   (ch chtype))
+
+
+
+(defcfun ("wattron" c-wattron) :int
+  (window :pointer)
+  (attrs :int))
+
+(defcfun ("wattroff" c-wattroff) :int
+  (window :pointer)
+  (attrs :int))
+
+(defcfun ("wgetch" c-wgetch) :int
+  (window :pointer))
+
+(defcfun ("cbreak" c-cbreak) :int)
+
+(defcfun ("noecho" c-noecho) :int)
+
+(defcfun ("keypad" c-keypad) :int
+  (window :pointer)
+  (bf :boolean))
+
+(defcfun ("nonl" c-nonl) :int)
