-
Notifications
You must be signed in to change notification settings - Fork 2
/
wrap.lisp
57 lines (43 loc) · 1.41 KB
/
wrap.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
(in-package :cffi-stfl)
(defvar *form* nil)
(defmacro with-form ((form &optional (persist nil)) &body body)
(once-only (form)
`(let ((*form* (if (pointerp ,form)
,form
(create ,form))))
,@(if persist
body
`(unwind-protect (progn
,@body)
(free))))))
(defun create (stfl-description)
(assert (stringp stfl-description));add conversion from some s-exp format later
(ipool-reset)
(%create (towc stfl-description)))
(defun free (&optional (form *form*))
(%free form))
(defun run (timeout &optional (form *form*))
(ipool-reset)
(fromwc (%run form timeout)))
(defun get (name &optional (form *form*))
(ipool-reset)
(fromwc (%get form (towc name))))
(defun set (name value &optional (form *form*))
(ipool-reset)
(%set form (towc name) (towc value)))
(defun get-focus (&optional (form *form*))
(ipool-reset)
(fromwc (%get-focus form)))
(defun set-focus (name &optional (form *form*))
(ipool-reset)
(%set-focus form (towc name)))
(defun dump (name prefix focus &optional (form *form*))
(fromwc (%dump form (towc name) (towc prefix) focus)))
(defun modify (name mode text &optional (form *form*))
(%modify form (towc name) (towc mode) (towc text)))
(defun lookup (path newname &optional (form *form*))
(fromwc (%lookup form (towc path) (towc newname))))
(defun get-error ()
(fromwc (%get-error)))
(defun error-action (mode)
(%error-action (towc mode)))