1 <?xml version='1.0' ?> <!-- Mode: Docbook -->
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "file:///usr/share/sgml/docbook/dtd/xml/4.2/docbookx.dtd" [
4 <!ENTITY % myents SYSTEM "entities.xml">
8 <reference id="primitives">
9 <title>Primitive Types</title>
11 <title>Overview</title>
13 Primitive types have a single value, these include
14 characters, numbers, and pointers. They are all symbols in
19 <para><constant>:char</constant> - Signed 8-bits. A
20 dereferenced :char pointer returns an character.</para>
23 <para><constant>:unsigned-char</constant> - Unsigned 8-bits. A dereferenced :unsigned-char
24 pointer returns an character.</para>
27 <para><constant>:byte</constant> - Signed 8-bits. A
28 dereferenced :byte pointer returns an integer.</para>
31 <para><constant>:unsigned-byte</constant> - Unsigned 8-bits. A
32 dereferenced :unsigned-byte pointer returns an integer.</para>
35 <para><constant>:short</constant> - Signed 16-bits.</para>
38 <para><constant>:unsigned-short</constant> - Unsigned 16-bits.</para>
41 <para><constant>:int</constant> - Signed 32-bits.</para>
44 <para><constant>:unsigned-int</constant> - Unsigned 32-bits.</para>
47 <para><constant>:long</constant> - Signed 32 or 64 bits, depending upon the platform.</para>
50 <para><constant>:unsigned-long</constant> - Unsigned 32 or 64 bits, depending upon the platform.</para>
53 <para><constant>:float</constant> - 32-bit floating point.</para>
56 <para><constant>:double</constant> - 64-bit floating point.</para>
59 <para><constant>:cstring</constant> -
60 A &null; terminated string used for passing and returning characters strings with a &c; function.
64 <para><constant>:void</constant> -
65 The absence of a value. Used to indicate that a function does not return a value.</para>
68 <para><constant>:pointer-void</constant> -
69 Points to a generic object.</para>
72 <para><constant>*</constant> - Used to declare a pointer to an object</para>
77 <refentry id="def-constant">
79 <refname>def-constant</refname>
80 <refpurpose>Binds a symbol to a constant.
82 <refclass>Macro</refclass>
87 <function>def-constant</function> <replaceable>name value &key export</replaceable>
91 <title>Arguments and Values</title>
94 <term><parameter>name</parameter></term>
96 <para>A symbol that will be bound to the value.
101 <term><parameter>value</parameter></term>
103 <para>An evaluated form that is bound the the name.
108 <term><parameter>export</parameter></term>
110 <para>When &t;, the name is exported from the current package. The default is &nil;</para>
116 <title>Description</title>
118 This is a thin wrapper around
119 <function>defconstant</function>. It evaluates at
120 compile-time and optionally exports the symbol from the package.
124 <title>Examples</title>
126 (def-constant pi2 (* 2 pi))
127 (def-constant exported-pi2 (* 2 pi) :export t)
131 <title>Side Effects</title>
132 <para>Creates a new special variable..</para>
135 <title>Affected by</title>
139 <title>Exceptional Situations</title>
144 <refentry id="def-foreign-type">
146 <refname>def-foreign-type</refname>
147 <refpurpose>Defines a new foreign type.
149 <refclass>Macro</refclass>
152 <title>Syntax</title>
154 <function>def-foreign-type</function> <replaceable>name type</replaceable>
158 <title>Arguments and Values</title>
161 <term><parameter>name</parameter></term>
163 <para>A symbol naming the new foreign type.
168 <term><parameter>value</parameter></term>
170 <para>A form that is not evaluated that defines the new
178 <title>Description</title>
179 <para>Defines a new foreign type.
183 <title>Examples</title>
185 (def-foreign-type my-generic-pointer :pointer-void)
186 (def-foreign-type a-double-float :double-float)
187 (def-foreign-type char-ptr (* :char))
191 <title>Side Effects</title>
192 <para>Defines a new foreign type.
196 <title>Affected by</title>
200 <title>Exceptional Situations</title>
205 <refentry id="null-char-p">
207 <refname>null-char-p</refname>
208 <refpurpose>Tests a character for &null; value.
210 <refclass>Macro</refclass>
213 <title>Syntax</title>
215 <function>null-char-p</function> <replaceable>char</replaceable> => <returnvalue>is-null</returnvalue>
219 <title>Arguments and Values</title>
222 <term><parameter>char</parameter></term>
224 <para>A character or integer.
229 <term><parameter>is-null</parameter></term>
231 <para>A boolean flag indicating if char is a &null; value.
238 <title>Description</title>
240 A predicate testing if a character or integer is &null;. This
241 abstracts the difference in implementations where some return a
242 <computeroutput>character</computeroutput> and some return a
243 <computeroutput>integer</computeroutput> whence dereferencing a
244 <computeroutput>C</computeroutput> character pointer.
248 <title>Examples</title>
250 (def-array-pointer ca :unsigned-char)
251 (let ((fs (convert-to-foreign-string "ab")))
252 (values (null-char-p (deref-array fs 'ca 0))
253 (null-char-p (deref-array fs 'ca 2))))
259 <title>Side Effects</title>
264 <title>Affected by</title>
268 <title>Exceptional Situations</title>