Changeset main,7


Ignore:
Timestamp:
10/18/2007 12:00:50 AM (19 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
tui
revision id:
dsowen@fugue88.ws-20071018000050-30ib4wcvwq99r2hz
Message:

Brought in more ncurses routines.
Support wide characters.
Begin flat-menus.

Location:
main
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • main/Makefile

    r5 r7  
    55form2.so: LIBS := -lform
    66
    7 cdk_wrapper.so: LIBS := -lcdk
     7cdk_wrapper.so: LIBS := -lcdkw
    88
    99%.so: %.c
    1010        rm -f $@
    11         gcc -shared -fPIC -o $@ $< $(LIBS) -Wall -pedantic
     11        gcc -shared -fPIC -Wall -pedantic -o $@ $< $(LIBS)
    1212
    1313clean:
  • main/cdk.lisp

    r6 r7  
    5050  (x :int))
    5151
     52(defcfun ("subwin" c-sub-window) :pointer
     53  (orig :pointer)
     54  (lines :int)
     55  (columns :int)
     56  (y :int)
     57  (x :int))
     58
     59(defcfun ("derwin" c-der-window) :pointer
     60  (orig :pointer)
     61  (lines :int)
     62  (columns :int)
     63  (y :int)
     64  (x :int))
     65
    5266(defcfun ("delwin" c-delete-window) :int
    5367  (window :pointer))
     
    5771  (vertical-ch chtype)
    5872  (horizontal-ch chtype))
     73
     74(defcfun ("wborder" c-window-border) :int
     75  (window :pointer)
     76  (ls chtype)
     77  (rs chtype)
     78  (ts chtype)
     79  (bs chtype)
     80  (tl chtype)
     81  (tr chtype)
     82  (bl chtype)
     83  (br chtype))
     84
     85(defcfun ("wbkgd" c-set-window-background) :int
     86  (window :pointer)
     87  (ch chtype))
     88
     89(defcfun ("werase" c-erase-window) :int
     90  (window :pointer))
     91
     92(defcfun ("mvwadd_wch" c-move-and-add-char) :int
     93  (window :pointer)
     94  (y :int)
     95  (x :int)
     96  (wch :pointer))
     97
     98(defcstruct cchar_t
     99  (attr chtype)
     100  (char :uint32 :count 5))
     101
     102
     103
     104(defcvar ("_nc_wacs" nc-wacs) :pointer :read-only t)
     105
     106(defun wacs-char (ch)
     107  (let ((code (char-code (ecase ch
     108                           (:ul-corner #\l)
     109                           (:ll-corner #\m)
     110                           (:ur-corner #\k)
     111                           (:lr-corner #\j)
     112                           (:r-tee #\u)
     113                           (:l-tee #\t)
     114                           (:b-tee #\v)
     115                           (:t-tee #\w)
     116                           (:h-line #\q)
     117                           (:v-line #\x)
     118                           (:plus #\n)))))
     119    (inc-pointer nc-wacs (* (foreign-type-size 'cchar_t) code))))
     120
     121(defun move-and-add-char (window y x ch)
     122  (with-foreign-object (s 'cchar_t)
     123    (with-foreign-slots ((attr char) s cchar_t)
     124      (setf attr 0)
     125      (dotimes (i 5)
     126        (setf (mem-aref char :uint32 i) 0))
     127      (setf (mem-aref char :uint32) (char-code ch)))
     128    (c-move-and-add-char window y x s)))
     129
     130(defun move-and-add-string (window y x s)
     131  (dotimes (i (length s))
     132    (move-and-add-char window y (+ x i) (aref s i))))
     133
     134(defcfun ("wrefresh" c-refresh-window) :int
     135  (window :pointer))
     136
     137(defun color-pair (n)
     138  (* 256 n))
    59139
    60140
     
    149229  (entry :pointer)
    150230  (ch chtype))
     231
     232
     233
     234(defcfun ("wattron" c-wattron) :int
     235  (window :pointer)
     236  (attrs :int))
     237
     238(defcfun ("wattroff" c-wattroff) :int
     239  (window :pointer)
     240  (attrs :int))
     241
     242(defcfun ("wgetch" c-wgetch) :int
     243  (window :pointer))
     244
     245(defcfun ("cbreak" c-cbreak) :int)
     246
     247(defcfun ("noecho" c-noecho) :int)
     248
     249(defcfun ("keypad" c-keypad) :int
     250  (window :pointer)
     251  (bf :boolean))
     252
     253(defcfun ("nonl" c-nonl) :int)
  • main/tui.asd

    r5 r7  
    44  :depends-on (#:cffi)
    55  :components (#|(:file "curses")|#
    6                (:file "cdk")))
     6               (:file "cdk")
     7               (:file "flat-menu"))
     8  :serial t)
Note: See TracChangeset for help on using the changeset viewer.