Debian Codegraph @

src/doc/old-manual/uffi/ref_primitive.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE book [
3 <!ENTITY % eclent SYSTEM "../ecl.ent">
4 %eclent;
5 ]>
6 <book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
7 <reference xml:id="uffi.primitives">
8 <title>Primitive Types</title>
9 <partintro>
10 <title>Overview</title>
11 <para>
12 Primitive types have a single value, these include
13 characters, numbers, and pointers. They are all symbols in
14 the keyword package.
15 </para>
16 <itemizedlist>
17 <listitem>
18 <para><constant>:char</constant> - Signed 8-bits. A
19 dereferenced :char pointer returns an character.
20 </para>
21 </listitem>
22 <listitem>
23 <para><constant>:unsigned-char</constant> - Unsigned 8-bits. A dereferenced :unsigned-char
24 pointer returns an character.
25 </para>
26 </listitem>
27 <listitem>
28 <para><constant>:byte</constant> - Signed 8-bits. A
29 dereferenced :byte pointer returns an integer.
30 </para>
31 </listitem>
32 <listitem>
33 <para><constant>:unsigned-byte</constant> - Unsigned 8-bits. A
34 dereferenced :unsigned-byte pointer returns an integer.
35 </para>
36 </listitem>
37 <listitem>
38 <para><constant>:short</constant> - Signed 16-bits.
39 </para>
40 </listitem>
41 <listitem>
42 <para><constant>:unsigned-short</constant> - Unsigned 16-bits.
43 </para>
44 </listitem>
45 <listitem>
46 <para><constant>:int</constant> - Signed 32-bits.</para>
47 </listitem>
48 <listitem>
49 <para><constant>:unsigned-int</constant> - Unsigned 32-bits.</para>
50 </listitem>
51 <listitem>
52 <para><constant>:long</constant> - Signed 32 or 64 bits, depending upon the platform.</para>
53 </listitem>
54 <listitem>
55 <para><constant>:unsigned-long</constant> - Unsigned 32 or 64 bits, depending upon the platform.</para>
56 </listitem>
57 <listitem>
58 <para><constant>:float</constant> - 32-bit floating point.</para>
59 </listitem>
60 <listitem>
61 <para><constant>:double</constant> - 64-bit floating point.</para>
62 </listitem>
63 <listitem>
64 <para><constant>:cstring</constant> -
65 A &NULL; terminated string used for passing and returning characters strings with a &C; function.
66 </para>
67 </listitem>
68 <listitem>
69 <para><constant>:void</constant> -
70 The absence of a value. Used to indicate that a function does not return a value.
71 </para>
72 </listitem>
73 <listitem>
74 <para><constant>:pointer-void</constant> - Points to a generic object.</para>
75 </listitem>
76 <listitem>
77 <para><constant>*</constant> - Used to declare a pointer to an object</para>
78 </listitem>
79 </itemizedlist>
80 </partintro>
81
82 <refentry xml:id="uffi.def-constant">
83 <refnamediv>
84 <refname><function>def-constant</function></refname>
85 <refpurpose>Binds a symbol to a constant.
86 </refpurpose>
87 </refnamediv>
88 <refsynopsisdiv>
89 <title>Macro</title>
90 <funcsynopsis>
91 <funcprototype>
92 <funcdef>def-constant</funcdef>
93 <paramdef><parameter>name</parameter></paramdef>
94 <paramdef><parameter>value</parameter></paramdef>
95 <paramdef><parameter>&key;</parameter></paramdef>
96 <paramdef><parameter>export</parameter></paramdef>
97 </funcprototype>
98 </funcsynopsis>
99 <variablelist>
100 <varlistentry>
101 <term><parameter>name</parameter></term>
102 <listitem>
103 <para>A symbol that will be bound to the value.
104 </para>
105 </listitem>
106 </varlistentry>
107 <varlistentry>
108 <term><parameter>value</parameter></term>
109 <listitem>
110 <para>An evaluated form that is bound the the name.
111 </para>
112 </listitem>
113 </varlistentry>
114 <varlistentry>
115 <term><parameter>export</parameter></term>
116 <listitem>
117 <para>When &t;, the name is exported from the current package. The default is &nil;</para>
118 </listitem>
119 </varlistentry>
120 </variablelist>
121 </refsynopsisdiv>
122
123 <refsect1>
124 <title>Description</title>
125 <para>This is a thin wrapper around <function>defconstant</function>. It evaluates at
126 compile-time and optionally exports the symbol from the package.
127 </para>
128 </refsect1>
129 <refsect1>
130 <title>Examples</title>
131 <screen>
132 (def-constant pi2 (* 2 pi))
133 (def-constant exported-pi2 (* 2 pi) :export t)</screen>
134 </refsect1>
135 <refsect1>
136 <title>Side Effects</title>
137 <para>Creates a new special variable..</para>
138 </refsect1>
139 <refsect1>
140 <title>Affected by</title>
141 <para>None.</para>
142 </refsect1>
143 <refsect1>
144 <title>Exceptional Situations</title>
145 <para>None.</para>
146 </refsect1>
147 </refentry>
148
149 <refentry xml:id="uffi.def-foreign-type">
150 <refnamediv>
151 <refname><function>def-foreign-type</function></refname>
152 <refpurpose>Defines a new foreign type.
153 </refpurpose>
154 </refnamediv>
155 <refsynopsisdiv>
156 <title>Macro</title>
157 <funcsynopsis>
158 <funcprototype>
159 <funcdef>def-foreign-type</funcdef>
160 <paramdef><parameter>name</parameter></paramdef>
161 <paramdef><parameter>type</parameter></paramdef>
162 </funcprototype>
163 </funcsynopsis>
164
165 <variablelist>
166 <varlistentry>
167 <term><parameter>name</parameter></term>
168 <listitem>
169 <para>A symbol naming the new foreign type.
170 </para>
171 </listitem>
172 </varlistentry>
173 <varlistentry>
174 <term><parameter>value</parameter></term>
175 <listitem>
176 <para>A form that is not evaluated that defines the new
177 foreign type.
178 </para>
179 </listitem>
180 </varlistentry>
181 </variablelist>
182 </refsynopsisdiv>
183
184 <refsect1>
185 <title>Description</title>
186 <para>Defines a new foreign type.
187 </para>
188 </refsect1>
189 <refsect1>
190 <title>Examples</title>
191 <screen>
192 (def-foreign-type my-generic-pointer :pointer-void)
193 (def-foreign-type a-double-float :double-float)
194 (def-foreign-type char-ptr (* :char))</screen>
195 </refsect1>
196 <refsect1>
197 <title>Side Effects</title>
198 <para>Defines a new foreign type.
199 </para>
200 </refsect1>
201 <refsect1>
202 <title>Affected by</title>
203 <para>None.</para>
204 </refsect1>
205 <refsect1>
206 <title>Exceptional Situations</title>
207 <para>None.</para>
208 </refsect1>
209 </refentry>
210
211 <refentry xml:id="uffi.null-char-p">
212 <refnamediv>
213 <refname><function>null-char-p</function></refname>
214 <refpurpose>Tests a character for &NULL; value.
215 </refpurpose>
216 </refnamediv>
217 <refsynopsisdiv>
218 <title>Macro</title>
219 <funcsynopsis>
220 <funcprototype>
221 <funcdef>null-char-p</funcdef>
222 <paramdef><parameter>char</parameter></paramdef>
223 </funcprototype>
224 </funcsynopsis>
225 <variablelist>
226 <varlistentry>
227 <term><parameter>char</parameter></term>
228 <listitem>
229 <para>A character or integer.
230 </para>
231 </listitem>
232 </varlistentry>
233 <varlistentry>
234 <term>returns</term>
235 <listitem>
236 <para>A boolean flag indicating if char is a &NULL; value.
237 </para>
238 </listitem>
239 </varlistentry>
240 </variablelist>
241 </refsynopsisdiv>
242
243 <refsect1>
244 <title>Description</title>
245
246 <para>A predicate testing if a character or integer is &NULL;. This
247 abstracts the difference in implementations where some return a
248 <computeroutput>character</computeroutput> and some return a
249 <computeroutput>integer</computeroutput> whence dereferencing a
250 <computeroutput>C</computeroutput> character pointer.
251 </para>
252 </refsect1>
253 <refsect1>
254 <title>Examples</title>
255 <screen>
256 (def-array-pointer ca :unsigned-char)
257 (let ((fs (convert-to-foreign-string "ab")))
258 (values (null-char-p (deref-array fs 'ca 0))
259 (null-char-p (deref-array fs 'ca 2))))
260 => &nil;
261 &t;</screen>
262 </refsect1>
263 <refsect1>
264 <title>Side Effects</title>
265 <para>None.
266 </para>
267 </refsect1>
268 <refsect1>
269 <title>Affected by</title>
270 <para>None.</para>
271 </refsect1>
272 <refsect1>
273 <title>Exceptional Situations</title>
274 <para>None.</para>
275 </refsect1>
276 </refentry>
277 </reference>
278 </book>
279 <!-- Keep this comment at the end of the file
280 Local variables:
281 mode: nxml
282 sgml-indent-step: 1
283 nxml-child-indent: 1
284 nxml-outline-child-indent: 0
285 fill-column: 79
286 End:
287 -->