1 | -*-Indented-Text-*- |
---|
2 | |
---|
3 | These notes describe the format of the .defs files |
---|
4 | |
---|
5 | |
---|
6 | (import "DEFS-FILE") |
---|
7 | (include "DEFS-FILE") |
---|
8 | |
---|
9 | |
---|
10 | |
---|
11 | (define-enum ENUM-TYPEDEF-NAME |
---|
12 | (LISP-SYM CPP-MACRO) |
---|
13 | ...) |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | (define-flags FLAGS-TYPEDEF-NAME |
---|
18 | (LISP-SYM CPP-MACRO) |
---|
19 | ...) |
---|
20 | |
---|
21 | |
---|
22 | |
---|
23 | (define-boxed BOXED-TYPEDEF-NAME |
---|
24 | ATTR ...) |
---|
25 | |
---|
26 | where each ATTR is one of: |
---|
27 | |
---|
28 | (copy C-COPY-FUN) |
---|
29 | (free C-FREE-FUN) |
---|
30 | (size "C sizeof expression") |
---|
31 | (fields FIELD ...) |
---|
32 | |
---|
33 | where each FIELD is (TYPE-SYM NAME-SYM OPTIONS...) |
---|
34 | each OPTION may be `(setter t)' denoting that the field |
---|
35 | is settable. Also `(getter FUNCTION-NAME)' defining a custom |
---|
36 | method of retrieving the value |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | (define-object OBJECT-TYPEDEF-NAME (SUPER-CLASS-TYPEDEF) |
---|
41 | ATTR ...) |
---|
42 | |
---|
43 | where each ATTR is one of: |
---|
44 | |
---|
45 | (fields FIELD ...) [as above] |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | (define-func C-FUNC-NAME |
---|
50 | RETURN-VALUE [RET-OPTIONS...] |
---|
51 | (ARG ...) |
---|
52 | OPTIONS...) |
---|
53 | |
---|
54 | where each ARG is (TYPE NAME-SYM [ARG-OPTIONS...) |
---|
55 | and each OPTION may be one of: |
---|
56 | |
---|
57 | (scm-name ACTUAL-NAME-STRING) |
---|
58 | (protection ARG) ; gc protect callback for life of ARG |
---|
59 | (protection t) ; gc protect callback always |
---|
60 | (protection *result*) ; gc protect for life of RETURN-VALUE |
---|
61 | (undeferred t) ; no scm interrupt protection? |
---|
62 | (rest-arg t) ; last arg is &rest |
---|
63 | |
---|
64 | and each ARG-OPTION may be one of: |
---|
65 | |
---|
66 | (= "default expression") |
---|
67 | (null-ok) ; allow nil |
---|
68 | (protect-during) |
---|
69 | |
---|
70 | and each RET-OPTION may be one of: |
---|
71 | |
---|
72 | (copy nil) ; unimplemented? |
---|
73 | |
---|
74 | |
---|
75 | |
---|
76 | (options OPTION ...) |
---|
77 | |
---|
78 | where each OPTION can be: |
---|
79 | |
---|
80 | (includes "#include expression") |
---|
81 | (init-func "name of C function") |
---|
82 | (other-inits "name of C function" ... ) |
---|
83 | (extra-init-code "code string") |
---|
84 | (provide FEATURE) |
---|
85 | |
---|
86 | the `provide' option generates the rep dl stub required to provide |
---|
87 | FEATURE and call the init-func when loaded |
---|
88 | |
---|
89 | |
---|
90 | |
---|
91 | GTK fundamental types seem to include: |
---|
92 | |
---|
93 | invalid, none, char, bool, int, uint, long, ulong, float, |
---|
94 | string, enum, flags, boxed, foreign, callback, args, pointer, |
---|
95 | signal, c-callback, object |
---|
96 | |
---|
97 | The guile-gtk .defs files seem to add the following: |
---|
98 | |
---|
99 | static_string, full_callback, file-descriptor, list, slist, |
---|
100 | double, SCM, cvec, cvecr, fvec, ret, tvec |
---|
101 | |
---|
102 | static_string: |
---|
103 | a static string returned from a function |
---|
104 | |
---|
105 | full_callback: |
---|
106 | a callback function used by the _full function variants (i.e. |
---|
107 | gtk_signal_connect_full). |
---|
108 | |
---|
109 | file-descriptor: |
---|
110 | an integer file descriptor |
---|
111 | |
---|
112 | double: |
---|
113 | a double-precision float |
---|
114 | |
---|
115 | SCM: |
---|
116 | a scheme object |
---|
117 | |
---|
118 | (list TYPE [MODE]): |
---|
119 | a glib GList* (doubly-linked) |
---|
120 | |
---|
121 | (slist TYPE [MODE]): |
---|
122 | a glib GSList* (singly-linked) |
---|
123 | |
---|
124 | (cvec TYPE [MODE]): |
---|
125 | a counted-vector, stored in sgtk_cvec struct, in gtk_ function calls, |
---|
126 | it expands ``cvec.data, cvec.len'' |
---|
127 | |
---|
128 | (cvecr TYPE [MODE]): |
---|
129 | similar to cvec but expands ``cvec.len, cvec.data'' |
---|
130 | |
---|
131 | (fvec TYPE LEN [MODE]): |
---|
132 | similar to cvec but fixed length |
---|
133 | |
---|
134 | (ret TYPE): |
---|
135 | similar to fvec but length is always one. used to mimic the C ``&foo'' |
---|
136 | idiom of returning multiple values |
---|
137 | |
---|
138 | (tvec TYPE [MODE]): |
---|
139 | zero-terminated vector |
---|
140 | |
---|
141 | [ in the above, MODE is one of `in', `out' or `inout'. Defaults to `in' ] |
---|
142 | |
---|