Index: main/cdk.lisp
===================================================================
--- main/cdk.lisp	(revision main,5)
+++ main/cdk.lisp	(revision main,5)
@@ -0,0 +1,115 @@
+(defpackage #:cdk
+  (:use #:cl #:cffi))
+
+(in-package #:cdk)
+
+
+
+(define-foreign-library cdk
+  (t "/home/dsowen/lisp/tui/cdk_wrapper.so"))
+
+(use-foreign-library cdk)
+
+
+;;; Screen-wide, initialization, and finalization routines.
+
+(defcfun ("initscr" c-init-curses-screen) :pointer)
+
+(defcfun ("endwin" c-end-curses) :int)
+
+(defcfun ("initCDKScreen" c-init-cdk-screen) :pointer
+  (curseswindow :pointer))
+
+(defcfun ("initCDKColor" c-init-color) :void)
+
+(defcfun ("eraseCDKScreen" c-erase-screen) :void
+  (screen :pointer))
+
+(defcfun ("destroyCDKScreen" c-destroy-screen) :void
+  (screen :pointer))
+
+(defcfun ("endCDK" c-end-cdk) :void)
+
+(defcfun ("refreshCDKScreen" c-refresh-screen) :void
+  (screen :pointer))
+
+(defcfun ("newwin" c-new-window) :pointer
+  (lines :int)
+  (columns :int)
+  (y :int)
+  (x :int))
+
+(defcfun ("delwin" c-delete-window) :int
+  (window :pointer))
+
+(defcfun ("box" c-box) :int
+  (window :pointer)
+  (vertical-ch :int)
+  (horizontal-ch :int))
+
+
+
+;;; Generic functions.
+
+(defcfun ("setCDKObjectBackgroundColor" c-set-background-color) :void
+  (object :pointer)
+  (color :string))
+
+
+
+;;; Labels.
+
+(defcfun ("newCDKLabel" c-new-label) :pointer
+  (screen :pointer)
+  (x-pos :int)
+  (y-pos :int)
+  (message :pointer)
+  (message-lines :int)
+  (box :boolean)
+  (shadow :boolean))
+
+(defcfun ("freeCDKLabel" c-free-label) :void
+  (label :pointer))
+
+(defcfun ("waitCDKLabel" c-wait-on-label) :char
+  (label :pointer)
+  (key :char))
+
+(defun new-label (screen row column text &optional box shadow)
+  (let* ((cstr (foreign-string-alloc text))
+         (array (foreign-alloc :pointer :initial-element cstr :count 1))
+         (label (c-new-label screen column row array 1 box shadow)))
+    (foreign-free array)
+    (foreign-string-free cstr)
+    label))
+
+
+
+;;; Entries.
+
+(defcfun ("newCDKEntry" c-new-entry) :pointer
+  (screen :pointer)
+  (x-pos :int)
+  (y-pos :int)
+  (title :string)
+  (label :string)
+  (attribute :int)
+  (filler :int)
+  (display-type :int)
+  (width :int)
+  (minimum-length :int)
+  (maximum-length :int)
+  (box :boolean)
+  (shadow :boolean))
+
+(defcfun ("freeCDKEntry" c-free-entry) :void
+  (entry :pointer))
+
+(defcfun ("activateCDKEntry" c-activate-entry) :string
+  (entry :pointer)
+  (actions :string))
+
+(defcfun ("setCDKEntryHighlight" c-set-entry-highlight) :void
+  (entry :pointer)
+  (highlight :unsigned-long)
+  (cursor :boolean))
