Changeset main,18


Ignore:
Timestamp:
11/02/2007 11:38:39 PM (19 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
tui
revision id:
dsowen@fugue88.ws-20071102233839-m98t0la9903jzudj
Message:

First pass at wrapping ncurses basics: lexical screens and der-windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/cdk.lisp

    r15 r18  
    11(defpackage #:cdk
    2   (:use #:cl #:cffi))
     2  (:use #:cl #:cffi)
     3  (:export #:with-screen #:with-der-window))
    34
    45(in-package #:cdk)
     
    3031(defcfun ("endwin" c-end-curses) :int)
    3132
     33(defmacro with-screen ((screen) &body body)
     34  `(let ((,screen (c-init-curses-screen)))
     35     (unwind-protect (progn ,@body)
     36       (c-end-curses))))
     37
    3238(defcfun ("initCDKScreen" c-init-cdk-screen) :pointer
    3339  (curseswindow :pointer))
     
    6874(defcfun ("delwin" c-delete-window) :int
    6975  (window :pointer))
     76
     77(defmacro with-der-window ((window parent lines columns y x) &body body)
     78  `(let ((,window (c-der-window ,parent ,lines ,columns ,y ,x)))
     79     (when (null-pointer-p ,window)
     80       ;; TODO: Replace this with a condition and a restart.
     81       (error "Couldn't create window."))
     82     (unwind-protect (progn ,@body)
     83       (c-delete-window ,window))))
    7084
    7185(defcfun ("box" c-box) :int
Note: See TracChangeset for help on using the changeset viewer.