pointer returns an character.</para>
</listitem>
<listitem>
- <para><constant>:byte</constant> - Unsigned 8-bits. A
+ <para><constant>:byte</constant> - Signed 8-bits. A
dereferenced :byte pointer returns an integer.</para>
+ </listitem>
+ <listitem>
+ <para><constant>:unsigned-byte</constant> - Unsigned 8-bits. A
+dereferenced :unsigned-byte pointer returns an integer.</para>
</listitem>
<listitem>
<para><constant>:short</constant> - Signed 16-bits.</para>
<varlistentry>
<term><parameter>size</parameter></term>
<listitem>
- <para>An optional size parameter. If specified, allocates and returns an
+ <para>An optional size parameter that is evaluated. If specified, allocates and returns an
array of <parameter>type</parameter> that is <parameter>size</parameter> members long. This parameter is evaluated.
</para>
</listitem>
</refsect1>
</refentry>
+ <refentry id="size-of-foreign-type">
+ <refnamediv>
+ <refname>size-of-foreign-type</refname>
+ <refpurpose>Returns the number of data bytes used by a foreign object type.
+ </refpurpose>
+ <refclass>Macro</refclass>
+ </refnamediv>
+ <refsynopsisdiv>
+ <title>Syntax</title>
+ <synopsis>
+ <function>size-of-foreign-type</function> <replaceable>ftype</replaceable>
+ </synopsis>
+ </refsynopsisdiv>
+ <refsect1>
+ <title>Arguments and Values</title>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>ftype</parameter></term>
+ <listitem>
+ <para>A foreign type specifier. This parameter is evaluated.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+ <refsect1>
+ <title>Description</title>
+ <para>
+ Returns the number of data bytes used by a foreign object type. This does not include any Lisp storage overhead.
+ </para>
+ </refsect1>
+ <refsect1>
+ <title>Examples</title>
+ <para>
+<programlisting>
+(size-of-foreign-object :unsigned-byte)
+=> 1
+(size-of-foreign-object 'my-100-byte-vector-type)
+=> 100
+</programlisting>
+ </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 id="pointer-address">
<refnamediv>
<refname>pointer-address</refname>
<partintro>
<title>Overview</title>
<para>
- &uffi; has functions to two types of <varname>C</varname>-compatible
+
+ &uffi; has functions to two types of
+<varname>C</varname>-compatible
strings, <emphasis>cstring</emphasis> and <emphasis>foreign</emphasis> strings.
-cstrings are used as parameters to and from functions. An implementation, such as CMUCL,
-may not convert these to a foreign type for efficiency sake. Thus, it is not
-possible to "allocate" a cstring. In contrast, foreign strings
-always need to have memory for them.
+
+cstrings are used as parameters to and from functions. An
+implementation, such as CMUCL and Lispworks, a cstring may not be a
+foreign type but rather the Lisp string itself while on other
+platforms a cstring is a newly allocated foreign vector for storing
+characters. Thus, it is not possible to portably
+<emphasis>allocate</emphasis> a cstring.
+</para>
+<para>
+In contrast, foreign strings
+are always a foreign vector of characters which have a memory
+allocated to hold them. Because of this, if you need to allocate memory to
+hold the return value of a string, use a foreign string and not a cstring.
</para>
</partintro>
</refsect1>
<refsect1>
<title>Side Effects</title>
- <para>None.</para>
+ <para>On some implementations, this function allocates memory.</para>
</refsect1>
<refsect1>
<title>Affected by</title>
<refsect1>
<title>Description</title>
<para>
- Binds a lexical variable to a newly allocated <varname>cstring</varname>. Automatically frees <varname>cstring</varname>.
+ Binds a symbol to a cstring created from conversion of a string. Automatically frees the <varname>cstring</varname>.
</para>
</refsect1>
<refsect1>