uffi/doc ref.sgml,1.35,1.36
"Kevin M. Rosenberg" <[email protected]> Thu, 14 Aug 2003 21:40:15 +0000
| Newsgroups | gmane.lisp.uffi.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /pubcvs/uffi/doc
In directory boa.b9.com:/tmp/cvs-serv19046/doc
Modified Files:
ref.sgml
Log Message:
def-foreign-var support
Index: ref.sgml
===================================================================
RCS file: /pubcvs/uffi/doc/ref.sgml,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** ref.sgml 14 Aug 2003 19:35:05 -0000 1.35
--- ref.sgml 14 Aug 2003 21:40:13 -0000 1.36
***************
*** 1516,1520 ****
<title>Syntax</title>
<synopsis>
! <function>with-cast-pointer</function> <replaceable>binding-name ptr type & body body</replaceable> => <returnvalue>value</returnvalue>
</synopsis>
</refsynopsisdiv>
--- 1516,1520 ----
<title>Syntax</title>
<synopsis>
! <function>with-cast-pointer</function> (<replaceable>binding-name ptr type) & body body</replaceable> => <returnvalue>value</returnvalue>
</synopsis>
</refsynopsisdiv>
***************
*** 1548,1556 ****
<title>Description</title>
<para>
! Executes BODY with POINTER casted to be a pointer to type TYPE. If
! BINDING-NAME is provided the casted pointer will be bound to this
name during the execution of BODY. If BINDING-NAME is not provided
POINTER must be a name bound to the pointer which should be
! casted. This name will be bound to the casted pointer during the
execution of BODY.
--- 1548,1556 ----
<title>Description</title>
<para>
! Executes BODY with POINTER cast to be a pointer to type TYPE. If
! BINDING-NAME is provided the cast pointer will be bound to this
name during the execution of BODY. If BINDING-NAME is not provided
POINTER must be a name bound to the pointer which should be
! cast. This name will be bound to the cast pointer during the
execution of BODY.
***************
*** 1562,1565 ****
--- 1562,1580 ----
DEREF-POINTER or DEREF-ARRAY.
</para>
+ </refsect1>
+ <refsect1>
+ <title>Examples</title>
+ <programlisting>
+ (with-foreign-object (size :int)
+ ;; FOO is a foreign function returning a :POINTER-VOID
+ (let ((memory (foo size)))
+ (when (mumble)
+ ;; at this point we know for some reason that MEMORY points
+ ;; to an array of unsigned bytes
+ (with-cast-pointer (memory :unsigned-byte)
+ (dotimes (i (deref-pointer size :int))
+ (do-something-with
+ (deref-array memory '(:array :unsigned-byte) i)))))))
+ </programlisting>
</refsect1>
<refsect1>