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))
Index: main/cdk_wrapper.c
===================================================================
--- main/cdk_wrapper.c	(revision main,5)
+++ main/cdk_wrapper.c	(revision main,5)
@@ -0,0 +1,10 @@
+#include <cdk/cdk.h>
+
+
+
+#define D(type, name) \
+	void freeCDK##name(CDK##type *object) \
+	{ destroyCDK##name(object); }
+
+D(LABEL, Label)
+D(ENTRY, Entry)
Index: main/Makefile
===================================================================
--- main/Makefile	(revision main,4)
+++ main/Makefile	(revision main,5)
@@ -1,3 +1,3 @@
-all: menu2.so form2.so
+all: menu2.so form2.so cdk_wrapper.so
 
 menu2.so: LIBS := -lmenu
@@ -5,5 +5,10 @@
 form2.so: LIBS := -lform
 
+cdk_wrapper.so: LIBS := -lcdk
+
 %.so: %.c
 	rm -f $@
 	gcc -shared -fPIC -o $@ $< $(LIBS) -Wall -pedantic
+
+clean:
+	rm -f *.so *.fasl
Index: main/curses.lisp
===================================================================
--- main/curses.lisp	(revision main,4)
+++ main/curses.lisp	(revision main,5)
@@ -14,4 +14,5 @@
 
 (defcfun initscr window*)
+(defcfun clear :int)
 (defcfun endwin :int)
 (defcfun refresh :int)
@@ -22,5 +23,7 @@
 (defcfun start-color :int)
 
-(defcvar stdscr :pointer :read-only t)
+(defcfun mvwaddstr :int (win :pointer) (y :int) (x :int) (str :string))
+
+(defcvar *stdscr* :pointer :read-only t)
 
 
@@ -58,8 +61,10 @@
 (defcdef req-left-char)
 (defcdef req-right-char)
+(defcdef o-active)
+(defcdef o-autoskip)
 
 (defcfun form2-create :int)
 (defcfun form2-add-field :int (form :int) (row :int) (col :int) (width :int)
-         (height :int) (data-height :int))
+         (height :int) (data-height :int) (opts-mask :int))
 (defcfun form2-destroy :int (form :int))
 (defcfun form2-post :int (form :int))
@@ -68,4 +73,5 @@
 (defcfun form2-field-len :int (form :int) (i :int))
 (defcfun form2-copy-field :int (form :int) (i :int) (buff :pointer) (len :int))
+(defcfun form2-set-field :int (form :int) (i :int) (buff :string))
 
 (defun form2-get-value (form i)
@@ -81,7 +87,8 @@
   (initscr)
   (start-color)
-  (keypad stdscr 1)
+  (keypad *stdscr* 1)
   (cbreak)
-  (noecho))
+  (noecho)
+  (clear))
 
 (defmacro ncase (keyform &rest clauses)
Index: main/form2.c
===================================================================
--- main/form2.c	(revision main,4)
+++ main/form2.c	(revision main,5)
@@ -26,4 +26,6 @@
 DC(req_left_char, REQ_LEFT_CHAR);
 DC(req_right_char, REQ_RIGHT_CHAR);
+DC(o_active, O_ACTIVE);
+DC(o_autoskip, O_AUTOSKIP);
 
 
@@ -93,5 +95,5 @@
 
 int form2_add_field(form2_h form, int row, int col, int width, int height,
-		int data_height)
+		int data_height, int opts_mask)
 {
 	struct form2_t *f = _check(form);
@@ -107,5 +109,5 @@
 	f->fields[*i] = new_field(height, width, row, col, data_height, 0);
 	set_field_back(f->fields[*i], A_UNDERLINE | COLOR_PAIR(1));
-	field_opts_off(f->fields[*i], O_AUTOSKIP);
+	field_opts_off(f->fields[*i], opts_mask);
 
 	++(*i);
@@ -193,2 +195,14 @@
 	return 1;
 }
+
+int form2_set_field(form2_h form, int i, const char *str)
+{
+	struct form2_t *f = _check(form);
+
+	if(!f) return 0;
+	if(!f->form_struct) return 0;
+
+	set_field_buffer(f->fields[i], 0, str);
+
+	return 1;
+}
Index: main/tui.asd
===================================================================
--- main/tui.asd	(revision main,1)
+++ main/tui.asd	(revision main,5)
@@ -3,3 +3,4 @@
 (asdf:defsystem #:tui
   :depends-on (#:cffi)
-  :components ((:file "curses")))
+  :components (#|(:file "curses")|#
+               (:file "cdk")))
