[d0e0b7]: uffi / ref_aggregate.xml Maximize Restore History

Download this file

ref_aggregate.xml    526 lines (510 with data), 14.6 kB

  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
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book [
<!ENTITY % eclent SYSTEM "../ecl.ent">
%eclent;
]>
<book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
<reference xml:id="uffi.aggregates">
<title>Aggregate Types</title>
<partintro>
<title>Overview</title>
<para>
Aggregate types are comprised of one or more primitive types.
</para>
</partintro>
<refentry xml:id="uffi.def-enum">
<refnamediv>
<refname><function>def-enum</function></refname>
<refpurpose>Defines a &C; enumeration.
</refpurpose>
<refclass>Macro</refclass>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
<synopsis>
<function>def-enum</function> <replaceable>name fields &amp;key separator-string</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Arguments and Values</title>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>A symbol that names the enumeration.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>fields</parameter></term>
<listitem>
<para>A list of field defintions. Each definition can be
a symbol or a list of two elements. Symbols get assigned a value of the
current counter which starts at <computeroutput>0</computeroutput> and
increments by <computeroutput>1</computeroutput> for each subsequent symbol. It the field definition is a list, the first position is the symbol and the second
position is the value to assign the the symbol. The current counter gets set
to <computeroutput>1+</computeroutput> this value.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>separator-string</parameter></term>
<listitem>
<para>A string that governs the creation of constants. The
default is <computeroutput>"#"</computeroutput>.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
Declares a &C; enumeration. It generates constants with integer values for the elements of the enumeration. The symbols for the these constant
values are created by the <function>concatenation</function> of the
enumeration name, separator-string, and field symbol. Also creates
a foreign type with the name <parameter>name</parameter> of type
<constant>:int</constant>.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<screen>
(def-enum abc (:a :b :c))
;; Creates constants abc#a (1), abc#b (2), abc#c (3) and defines
;; the foreign type "abc" to be :int
(def-enum efoo (:e1 (:e2 10) :e3) :separator-string "-")
;; Creates constants efoo-e1 (1), efoo-e2 (10), efoo-e3 (11) and defines
;; the foreign type efoo to be :int</screen>
</refsect1>
<refsect1>
<title>Side Effects</title>
<para>Creates a :int foreign type, defines constants.</para>
</refsect1>
<refsect1>
<title>Affected by</title>
<para>None.</para>
</refsect1>
<refsect1>
<title>Exceptional Situations</title>
<para>None.</para>
</refsect1>
</refentry>
<refentry xml:id="uffi.def-struct">
<refnamediv>
<refname><function>def-struct</function></refname>
<refpurpose>Defines a &C; structure.
</refpurpose>
<refclass>Macro</refclass>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
<synopsis>
<function>def-struct</function> <replaceable>name &amp;rest fields</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Arguments and Values</title>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>A symbol that names the structure.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>fields</parameter></term>
<listitem>
<para>A variable number of field defintions. Each definition is a list consisting of a symbol naming the field followed by its foreign type.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
Declares a structure. A special type is available as a slot
in the field. It is a pointer that points to an instance of the parent
structure. It's type is <constant>:pointer-self</constant>.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<screen>
(def-struct foo (a :unsigned-int)
(b (* :char))
(c (:array :int 10))
(next :pointer-self))</screen>
</refsect1>
<refsect1>
<title>Side Effects</title>
<para>Creates a foreign type.</para>
</refsect1>
<refsect1>
<title>Affected by</title>
<para>None.</para>
</refsect1>
<refsect1>
<title>Exceptional Situations</title>
<para>None.</para>
</refsect1>
</refentry>
<refentry xml:id="uffi.get-slot-value">
<refnamediv>
<refname><function>get-slot-value</function></refname>
<refpurpose>Retrieves a value from a slot of a structure.
</refpurpose>
<refclass>Macro</refclass>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
<synopsis>
<function>get-slot-value</function> <replaceable>obj type field</replaceable> => <returnvalue>value</returnvalue>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Arguments and Values</title>
<variablelist>
<varlistentry>
<term><parameter>obj</parameter></term>
<listitem>
<para>A pointer to foreign structure.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>A name of the foreign structure.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>field</parameter></term>
<listitem>
<para>A name of the desired field in foreign structure.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><returnvalue>value</returnvalue></term>
<listitem>
<para>The value of the field in the structure.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
Accesses a slot value from a structure. This is generalized
and can be used with <function>setf</function>.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<screen>
(get-slot-value foo-ptr 'foo-structure 'field-name)
(setf (get-slot-value foo-ptr 'foo-structure 'field-name) 10)</screen>
</refsect1>
<refsect1>
<title>Side Effects</title>
<para>None.</para>
</refsect1>
<refsect1>
<title>Affected by</title>
<para>None.</para>
</refsect1>
<refsect1>
<title>Exceptional Situations</title>
<para>None.</para>
</refsect1>
</refentry>
<refentry xml:id="uffi.get-slot-pointer">
<refnamediv>
<refname><function>get-slot-pointer</function></refname>
<refpurpose>Retrieves a pointer from a slot of a structure.
</refpurpose>
<refclass>Macro</refclass>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
<synopsis>
<function>get-slot-pointer</function> <replaceable>obj type field</replaceable> => <returnvalue>pointer</returnvalue>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Arguments and Values</title>
<variablelist>
<varlistentry>
<term><parameter>obj</parameter></term>
<listitem>
<para>A pointer to foreign structure.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>A name of the foreign structure.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>field</parameter></term>
<listitem>
<para>A name of the desired field in foreign structure.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><returnvalue>pointer</returnvalue></term>
<listitem>
<para>The value of the field in the structure.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
This is similar to <function>get-slot-value</function>. It
is used when the value of a slot is a pointer type.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<screen>
(get-slot-pointer foo-ptr 'foo-structure 'my-char-ptr)</screen>
</refsect1>
<refsect1>
<title>Side Effects</title>
<para>None.</para>
</refsect1>
<refsect1>
<title>Affected by</title>
<para>None.</para>
</refsect1>
<refsect1>
<title>Exceptional Situations</title>
<para>None.</para>
</refsect1>
</refentry>
<refentry xml:id="uffi.def-array-pointer">
<refnamediv>
<refname><function>def-array-pointer</function></refname>
<refpurpose>Defines a pointer to a array of type.
</refpurpose>
<refclass>Macro</refclass>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
<synopsis>
<function>def-array-pointer</function> <replaceable>name type</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Arguments and Values</title>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>A name of the new foreign type.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>The foreign type of the array elements.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
Defines a type tat is a pointer to an array of type.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<screen>
(def-array-pointer byte-array-pointer :unsigned-char)</screen>
</refsect1>
<refsect1>
<title>Side Effects</title>
<para>Defines a new foreign type.</para>
</refsect1>
<refsect1>
<title>Affected by</title>
<para>None.</para>
</refsect1>
<refsect1>
<title>Exceptional Situations</title>
<para>None.</para>
</refsect1>
</refentry>
<refentry xml:id="uffi.deref-array">
<refnamediv>
<refname><function>deref-array</function></refname>
<refpurpose>Deference an array.
</refpurpose>
<refclass>Macro</refclass>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
<synopsis>
<function>deref-array</function> <replaceable>array type position</replaceable> => <returnvalue>value</returnvalue>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Arguments and Values</title>
<variablelist>
<varlistentry>
<term><parameter>array</parameter></term>
<listitem>
<para>A foreign array.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>The foreign type of the array.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>position</parameter></term>
<listitem>
<para>An integer specifying the position to retrieve from
the array.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><returnvalue>value</returnvalue></term>
<listitem>
<para>The value stored in the position of the array.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
Dereferences (retrieves) the value of an array element.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<screen>
(def-array-pointer ca :char)
(let ((fs (convert-to-foreign-string "ab")))
(values (null-char-p (deref-array fs 'ca 0))
(null-char-p (deref-array fs 'ca 2))))
=> &nil;
&t;</screen>
</refsect1>
<refsect1>
<title>Notes</title>
<para>
The TYPE argument is ignored for CL implementations other than
AllegroCL. If you want to cast a pointer to another type use
WITH-CAST-POINTER together with DEREF-POINTER/DEREF-ARRAY.
</para>
</refsect1>
<refsect1>
<title>Side Effects</title>
<para>None.</para>
</refsect1>
<refsect1>
<title>Affected by</title>
<para>None.</para>
</refsect1>
<refsect1>
<title>Exceptional Situations</title>
<para>None.</para>
</refsect1>
</refentry>
<refentry xml:id="uffi.def-union">
<refnamediv>
<refname><function>def-union</function></refname>
<refpurpose>Defines a foreign union type.
</refpurpose>
<refclass>Macro</refclass>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
<synopsis>
<function>def-union</function> <replaceable>name &amp;rest fields</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Arguments and Values</title>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>A name of the new union type.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>fields</parameter></term>
<listitem>
<para>A list of fields of the union.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
Defines a foreign union type.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<screen>
(def-union test-union
(a-char :char)
(an-int :int))
(let ((u (allocate-foreign-object 'test-union)))
(setf (get-slot-value u 'test-union 'an-int) (+ 65 (* 66 256)))
(prog1
(ensure-char-character (get-slot-value u 'test-union 'a-char))
(free-foreign-object u)))
=> #\A</screen>
</refsect1>
<refsect1>
<title>Side Effects</title>
<para>Defines a new foreign type.</para>
</refsect1>
<refsect1>
<title>Affected by</title>
<para>None.</para>
</refsect1>
<refsect1>
<title>Exceptional Situations</title>
<para>None.</para>
</refsect1>
</refentry>
</reference>
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: nxml
sgml-indent-step: 1
nxml-child-indent: 1
nxml-outline-child-indent: 0
fill-column: 79
End:
-->