Ignore:
Timestamp:
11/03/2007 01:59:12 AM (19 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
tui
revision id:
dsowen@fugue88.ws-20071103015912-8vledq756a3oa45e
Message:

Modified text-output to allow *not* moving the cursor.
Added display-strings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tag/last-working/cdk.lisp

    r18 r22.1.1  
    11(defpackage #:cdk
    22  (:use #:cl #:cffi)
    3   (:export #:with-screen #:with-der-window))
     3  (:export #:with-screen #:with-der-window #:add-ch #:add-string #:wmove))
    44
    55(in-package #:cdk)
     
    127127  (x :int))
    128128
    129 (defcfun ("mvwadd_wch" c-move-and-add-char) :int
    130   (window :pointer)
    131   (y :int)
    132   (x :int)
     129(defcfun "wadd_wch" :int
     130  (window :pointer)
    133131  (wch :pointer))
    134132
     
    157155    (inc-pointer nc-wacs (* (foreign-type-size 'cchar_t) code))))
    158156
    159 (defun move-and-add-char (window y x ch)
     157(defcfun ("wmove" c-wmove) :int
     158  (window :pointer)
     159  (y :int)
     160  (x :int))
     161
     162(defun add-char (window ch)
    160163  (with-foreign-object (s 'cchar_t)
    161164    (with-foreign-slots ((attr char) s cchar_t)
     
    164167        (setf (mem-aref char :uint32 i) 0))
    165168      (setf (mem-aref char :uint32) (char-code ch)))
    166     (c-move-and-add-char window y x s)))
     169    (wadd-wch window s)))
     170
     171(defun add-string (window s)
     172  (dotimes (i (length s))
     173    (add-char window (aref s i))))
     174
     175(defun move-and-add-char (window y x ch)
     176  (wmove window y x)
     177  (add-char window ch))
    167178
    168179(defun move-and-add-string (window y x s)
    169   (dotimes (i (length s))
    170     (move-and-add-char window y (+ x i) (aref s i))))
    171 
    172 (defcfun ("wmove" c-wmove) :int
    173   (window :pointer)
    174   (y :int)
    175   (x :int))
     180  (wmove window y x)
     181  (add-string window s))
    176182
    177183(defcfun ("wrefresh" c-refresh-window) :int
Note: See TracChangeset for help on using the changeset viewer.