Ignore:
Timestamp:
09/19/2007 11:06:52 PM (19 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
tui
revision id:
dsowen@fugue88.ws-20070919230652-gcf3h1qwf86lq8j7
Message:

Using my own menu library to ease memory management and pointer logic.

File:
1 edited

Legend:

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

    r1 r2  
    2222
    2323
    24 (define-foreign-library menu
    25   (t (:default "libmenu")))
     24(define-foreign-library menu2
     25  (t "/home/dsowen/lisp/tui/menu2.so"))
    2626
    27 (use-foreign-library menu)
     27(use-foreign-library menu2)
    2828
    29 (defctype item* :pointer)
    30 (defctype menu* :pointer)
    31 
    32 (defcfun new-item item* (name :string) (description :string))
    33 (defcfun free-item :int (item item*))
    34 (defcfun new-menu menu* (items :pointer))
    35 (defcfun post-menu :int (menu menu*))
    36 (defcfun menu-driver :int (menu menu*) (c :int))
     29(defcfun menu2-create :int)
     30(defcfun menu2-add-item :int (menu :int) (name :string) (description :string))
     31(defcfun menu2-destroy :int (menu :int))
     32(defcfun menu2-post :int (menu :int))
     33(defcfun menu2-drive :int (menu :int) (c :int))
     34(defcfun menu2-unpost :int (menu :int))
    3735
    3836
    39 
    40 (defun make-menu (items)
    41   (let* ((items-vector
    42           (map 'vector
    43                (lambda (item)
    44                  (etypecase item
    45                    (string (new-item (foreign-string-alloc item) (foreign-string-alloc item)))
    46                    (cons (new-item (foreign-string-alloc (car item)) (foreign-string-alloc (cdr item))))))
    47                items))
    48          (foreign-items (foreign-alloc 'item*
    49                                        :count (length items-vector)
    50                                        :initial-contents items-vector
    51                                        :null-terminated-p t)))
    52     (new-menu foreign-items)))
    5337
    5438(defun init-screen ()
Note: See TracChangeset for help on using the changeset viewer.