Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > e3d62627d1d1aab7ab1be2dd7f65a872 > files > 407

ecl-10.4.1-1.fc14.x86_64.rpm

<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>with-cstring</title><link rel="stylesheet" href="ecl.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="The ECL manual"><link rel="up" href="rn04.html" title="Strings"><link rel="prev" href="rn04re71.html" title="free-cstring"><link rel="next" href="rn04re73.html" title="convert-from-foreign-string"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><code class="function">with-cstring</code></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="rn04re71.html">Prev</a>&#160;</td><th width="60%" align="center">Strings</th><td width="20%" align="right">&#160;<a accesskey="n" href="rn04re73.html">Next</a></td></tr></table><hr></div><div class="refentry" title="with-cstring"><a name="uffi.with-cstring"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p><code class="function">with-cstring</code> &#8212; Binds a newly created cstring.<b>Macro</b></p></div><div class="refsynopsisdiv" title="Syntax"><h2>Syntax</h2><pre class="synopsis">
     <code class="function">with-cstring</code>
     <em class="replaceable"><code>(cstring string) {body}</code></em>
    </pre></div><div class="refsect1" title="Arguments and Values"><a name="id693873"></a><h2>Arguments and Values</h2><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>cstring</code></em></span></p></td><td><p>A symbol naming the cstring to be created.
       </p></td></tr><tr><td><p><span class="term"><em class="parameter"><code>string</code></em></span></p></td><td><p>A Lisp string that will be translated to a cstring.
       </p></td></tr><tr><td><p><span class="term"><em class="parameter"><code>body</code></em></span></p></td><td><p>The body of where the cstring will be bound.
       </p></td></tr></tbody></table></div></div><div class="refsect1" title="Description"><a name="id693934"></a><h2>Description</h2><p>
     Binds a symbol to a cstring created from conversion of a
     string. Automatically frees the <code class="varname">cstring</code>.
    </p></div><div class="refsect1" title="Examples"><a name="id693948"></a><h2>Examples</h2><p>
     </p><pre class="programlisting">
(def-function ("getenv" c-getenv) 
   ((name :cstring))
   :returning :cstring)

(defun getenv (key)
  "Returns an environment variable, or NIL if it does not exist"
  (check-type key string)
  (with-cstring (key-cstring key)
     (convert-from-cstring (c-getenv key-cstring))))</pre><p>
    </p></div><div class="refsect1" title="Side Effects"><a name="id693966"></a><h2>Side Effects</h2><p>None.</p></div><div class="refsect1" title="Affected by"><a name="id693976"></a><h2>Affected by</h2><p>None.</p></div><div class="refsect1" title="Exceptional Situations"><a name="id693986"></a><h2>Exceptional Situations</h2><p>None.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="rn04re71.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="rn04.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="rn04re73.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><code class="function">free-cstring</code>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<code class="function">convert-from-foreign-string</code></td></tr></table></div></body></html>