Sophie

Sophie

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

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>2.2.&#160;Constructing objects</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="ch25.html" title="Chapter&#160;2.&#160;Manipulating Lisp objects"><link rel="prev" href="ch25.html" title="Chapter&#160;2.&#160;Manipulating Lisp objects"><link rel="next" href="ch25s03.html" title="2.3.&#160;Integers"></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">2.2.&#160;Constructing objects</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch25.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;2.&#160;Manipulating Lisp objects</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch25s03.html">Next</a></td></tr></table><hr></div><div class="section" title="2.2.&#160;Constructing objects"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="Internals-Constructing-objects"></a>2.2.&#160;Constructing objects</h2></div></div></div><p>On each of the following sections we will document the standard interface for
  building objects of different types. For some objects, though, it is too
  difficult to make a C interface that resembles all of the functionality in the
  lisp environment. In those cases you need to</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>build the objects from their textual representation, or</p></li><li class="listitem"><p>use the evaluator to build these objects.</p></li></ol></div><p class="continues">The first way makes use of a C or Lisp string to construct an object. The two
  functions you need to know are the following ones.</p><div class="blockquote"><blockquote class="blockquote"><pre class="screen"><a class="indexterm" name="id676937"></a>&#8212; Function: <span class="returnvalue">cl_object</span> <code class="function">c_string_to_object</code> (<span class="type">const</span> <code class="varname">char</code> <span class="type">*</span><code class="varname">s</code>)</pre><pre class="screen"><a class="indexterm" name="id676972"></a>&#8212; Function: <span class="returnvalue">cl_object</span> <code class="function">string_to_object</code> (<span class="type">cl_object</span> <code class="varname">o</code>)</pre><p><code class="literal">c_string_to_object</code> builds a lisp object from a C string which contains a
   suitable representation of a lisp object. <code class="literal">string_to_object</code> performs the
   same task, but uses a lisp string, and therefore it is less useful. Two
   examples of their use</p><pre class="screen">
    /* Using a C string */
    cl_object array1 = c_string_to_object("#(1 2 3 4)");

    /* Using a Lisp string */
    cl_object string = make_simple_string("#(1 2 3 4)");
    cl_object array2 = string_to_object(string);
   </pre></blockquote></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch25.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch25.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="ch25s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&#160;2.&#160;Manipulating Lisp objects&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;2.3.&#160;Integers</td></tr></table></div></body></html>