474
|
1
|
;;; pkg.lisp --- Glib FFI |
|
2
|
|
|
3
|
;; |
|
4
|
|
|
5
|
;;; Code: |
|
6
|
(defpackage :glib |
|
7
|
(:use :cl :std :sb-alien) |
|
8
|
(:export)) |
|
9
|
|
|
10
|
(in-package :glib) |
|
11
|
|
|
12
|
(define-alien-loader glib t "/usr/lib/" "glib-2.0") |
|
13
|
|
475
|
14
|
(define-alien-type gtype unsigned) |
|
15
|
|
|
16
|
(define-alien-type gtype-interface (* t)) |
|
17
|
|
|
18
|
(eval-always |
|
19
|
(define-opaque gmainloop) |
|
20
|
(define-opaque gmaincontext) |
|
21
|
(define-opaque gobjectgroup) |
|
22
|
(define-opaque glist)) |
474
|
23
|
|
|
24
|
(define-alien-type ginitially-unowned (* t)) |
|
25
|
(define-alien-type gmutex (* t)) |
|
26
|
(define-alien-type gpointer (* t)) |
|
27
|
|
|
28
|
(define-alien-type glist-t |
|
29
|
(struct glist |
|
30
|
(data gpointer) |
|
31
|
(next (* glist)) |
|
32
|
(prev (* glist)))) |
|
33
|
|
|
34
|
(define-alien-type grec-mutex |
|
35
|
(struct grec-mutex |
|
36
|
(p gpointer) |
|
37
|
(i (array unsigned-int 2)))) |
|
38
|
|
|
39
|
(define-alien-routine g-main-loop-new (* gmainloop) (context (* gmaincontext)) (is-running boolean)) |
|
40
|
|
|
41
|
(define-alien-type gquark (unsigned 32)) |
|
42
|
(define-alien-type gerror (struct gerror |
|
43
|
(domain gquark) |
|
44
|
(code int) |
|
45
|
(message c-string))) |
|
46
|
|
|
47
|
(define-opaque goptioncontext (* t)) |
|
48
|
(define-opaque goptiongroup (* t)) |
|
49
|
(define-opaque goptionentry (* t)) |
|
50
|
|
|
51
|
(define-alien-enum (goption-flags int) |
|
52
|
:none 0 |
|
53
|
:hidden (ash 1 0) |
|
54
|
:in-main (ash 1 1) |
|
55
|
:reverse (ash 1 2) |
|
56
|
:no-arg (ash 1 3) |
|
57
|
:filename (ash 1 4) |
|
58
|
:optional-arg (ash 1 5) |
|
59
|
:noalias (ash 1 6)) |
|
60
|
|
|
61
|
(define-alien-enum (goption-arg int) |
|
62
|
:none 0 |
|
63
|
:string 1 |
|
64
|
:int 2 |
|
65
|
:callback 3 |
|
66
|
:filename 4 |
|
67
|
:string-array 5 |
|
68
|
:filename-array 6 |
|
69
|
:double 7 |
|
70
|
:int64 8) |
|
71
|
|
|
72
|
(define-alien-routine g-option-error-quark gquark) |