|
@@ -2,11 +2,6 @@
|
2
|
2
|
|
3
|
3
|
(in-package #:bearlibterminal-internal)
|
4
|
4
|
|
5
|
|
-(defun foreign-collect (wrapped-ptr &optional (free-fun #'cffi:foreign-free))
|
6
|
|
- (let ((ptr (autowrap:ptr wrapped-ptr)))
|
7
|
|
- (tg:finalize wrapped-ptr (lambda () (funcall free-fun ptr)))
|
8
|
|
- wrapped-ptr))
|
9
|
|
-
|
10
|
5
|
(defun terminal-print (x y string)
|
11
|
6
|
(terminal-print8 x y string))
|
12
|
7
|
|
|
@@ -17,9 +12,11 @@
|
17
|
12
|
(terminal-measure8 string))
|
18
|
13
|
|
19
|
14
|
(defun terminal-read-str (x y max)
|
20
|
|
- (let ((input (foreign-collect (cffi:foreign-alloc :char :initial-element 0 :count max))))
|
21
|
|
- (terminal-read-str8 x y input max)
|
22
|
|
- (cffi:foreign-string-to-lisp input)))
|
|
15
|
+ (let ((input-buffer (cffi:foreign-alloc :char :initial-element 0 :count max)))
|
|
16
|
+ (terminal-read-str8 x y input-buffer max)
|
|
17
|
+ (let ((input-string (cffi:foreign-string-to-lisp input-buffer)))
|
|
18
|
+ (cffi:foreign-free input-buffer)
|
|
19
|
+ input-string)))
|
23
|
20
|
|
24
|
21
|
(defun terminal-get (key default)
|
25
|
22
|
(terminal-get8 key default))
|