1
0
Fork 0
cl-sites/ecl.common-lisp.dev/static/manual/Symbols.html

251 lines
12 KiB
HTML
Raw Permalink Normal View History

2024-12-24 19:15:49 +01:00
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.0.3, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Symbols (ECL Manual)</title>
<meta name="description" content="Symbols (ECL Manual)">
<meta name="keywords" content="Symbols (ECL Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Indexes.html" rel="index" title="Indexes">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Standards.html" rel="up" title="Standards">
<link href="Packages.html" rel="next" title="Packages">
<link href="Conditions.html" rel="prev" title="Conditions">
<style type="text/css">
<!--
/* colors */
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span.r {font-family: initial; font-weight: normal; font-style: normal}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
ul.mark-bullet {list-style-type: disc}
@media (prefers-color-scheme: dark) {
/* dark theme */
html { color: seashell;
background: #1A1A1A; }
body { background: #1A1A1A; }
th { border-bottom: 2px solid lightgray; }
h1, h2, h3, h4, h5 { background-image: linear-gradient(to left, #202020, #3A3A3A); }
code, var, code a { color: darkorange;
background: #2A2A2A; }
a { color: seashell; }
pre { background: #2A2A2A;
color: seashell;
/* mark longer code block with stripe on the left */
border-left: 5px solid darkorange;
padding-left: 10px; }
pre.screen { background: #2A2A2A;
border: 1px solid lightgray; }
pre.programlisting { background: #2A2A2A;
border-left: 1px solid lightgray;
border-top: 1px solid lightgray; }
/* we need a light background in order for the images to be readable */
img { background: white }
}
@media (prefers-color-scheme: light) {
/* light theme */
html { background: white }
body { background: white }
th { border-bottom: 2px solid gray; }
h1, h2, h3, h4, h5 { background: lightgray; }
code, var, code a { color: darkred;
background: whitesmoke; }
a { color: #000; }
pre { background: whitesmoke;
color: black;
/* mark longer code block with stripe on the left */
border-left: 5px solid darkred;
padding-left: 10px; }
pre.screen { background: #EEE;
border: 1px solid black; }
pre.programlisting { background: #EEEEEE;
border-left: 1px solid black;
border-top: 1px solid black; }
}
body {
margin: 1em 125px 0 10%;
line-height: 1.5em;
padding: 0 2em 1em 2em;
font: 13px Verdana,Arial, sans-serif
}
ul, dd, dl, dt { margin-top: 0; margin-bottom: 0; }
p, code, td, dl, dt {
line-height: 1.5em;
}
table {
font: inherit;
border-collapse: collapse;
}
th, td {
vertical-align: top;
}
h1, h2, h3 { padding-left: 15px; }
h4, h5 { padding-left: 5px; }
code, pre {
font-size: 1em;
font-family: monospace;
}
var {
font-size: 1em;
}
/* links inside code appear the same as the code itself */
code a {
font-weight: normal;
text-decoration: none;
}
/* but get an underline when hovering */
code a:hover {
text-decoration: underline;
}
/* ordinary links appear in bold */
a { font-weight: bold; }
pre.verbatim {
margin: 0 0 0 0;
}
pre {
overflow: auto;
}
pre.screen {
font-weight: bold;
padding: 0.5em;
}
pre.programlisting {
padding: 0.5em;
}
div p { padding: 0 2em }
li p { padding: 0; margin: 0 }
hr { display: none; }
div.funcsynopsis p {
text-indent: -2em;
}
div.variablelist {
padding: 0 2em;
}
.type, .funcsynopsis, .symbol {
font-family: monospace;
}
.type, .symbol, .replaceable {
white-space: nowrap;
}
-->
</style>
</head>
<body lang="en">
<div class="section-level-extent" id="Symbols">
<div class="nav-panel">
<p>
Next: <a href="Packages.html" accesskey="n" rel="next">Packages</a>, Previous: <a href="Conditions.html" accesskey="p" rel="prev">Conditions</a>, Up: <a href="Standards.html" accesskey="u" rel="up">Standards</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indexes.html" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Symbols-1">2.8 Symbols</h3>
<p>There are no implementation-specific limits on the size or content of symbol names. It is however not allowed to write on the strings which have been passed to <code class="code">#'make-symbol</code> or returned from <code class="code">#'symbol-name</code>.
</p>
<ul class="mini-toc">
<li><a href="Symbols.html#C-Reference-8" accesskey="1">C Reference</a></li>
</ul>
<div class="subsection-level-extent" id="C-Reference-8">
<h4 class="subsection">2.8.1 C Reference</h4>
<a class="anchor" id="ecl_005fmake_005fkeyword"></a><a class="index-entry-id" id="index-ecl_005fmake_005fkeyword"></a>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
<dt class="deftypefn deftypefun-alias-deftypefn" id="index-ecl_005fmake_005fkeyword-1"><span class="category-def">Function: </span><span><code class="def-type">cl_object</code> <strong class="def-name">ecl_make_keyword</strong> <code class="def-code-arguments">(char *name);</code><a class="copiable-link" href='Symbols.html#index-ecl_005fmake_005fkeyword-1'> &para;</a></span></dt>
<dd><p>Find a lisp keyword
</p>
<p><b class="b">Description</b>
</p>
<p>Many Lisp functions take keyword arguments. When invoking a function with keyword arguments we need keywords, which are a kind of symbols that live in the <code class="code">keyword</code> package. This function does the task of finding or creating those keywords from C strings.
</p>
<ul class="itemize mark-bullet">
<li>It is usually safe to store the resulting pointer, because keywords are always referenced by their package and will not be garbage collected (unless of course, you decide to delete it).
</li><li>Remember that the case of the string is significant. <code class="code">ecl_make_keyword(&quot;TO&quot;)</code> with return <code class="code">:TO</code>, while <code class="code">ecl_make_keyword(&quot;to&quot;)</code> returns a completely different keyword, <code class="code">:|to|</code>. In short, you usually want to use uppercase.
</li></ul>
<p><b class="b">Example</b>
</p>
<p>The following example converts a section of a string to uppercase characters:
</p>
<div class="example">
<pre class="example-preformatted">cl_object start = ecl_make_keyword(&quot;START&quot;);
cl_object end = ecl_make_keyword(&quot;END&quot;);
...
sup = cl_string_upcase(4, s, start, ecl_make_fixnum(2),
end, ecl_make_fixnum(6));
</pre></div>
</dd></dl>
<a class="anchor" id="ecl_005fmake_005fsymbol"></a><a class="index-entry-id" id="index-ecl_005fmake_005fsymbol"></a>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
<dt class="deftypefn deftypefun-alias-deftypefn" id="index-ecl_005fmake_005fsymbol-1"><span class="category-def">Function: </span><span><code class="def-type">cl_object</code> <strong class="def-name">ecl_make_symbol</strong> <code class="def-code-arguments">(const char *name, const char *package_name);</code><a class="copiable-link" href='Symbols.html#index-ecl_005fmake_005fsymbol-1'> &para;</a></span></dt>
<dd><p>Find a lisp symbol
</p>
<p><b class="b">Description</b>
</p>
<p>This function finds or create a symbol in the given package. First of
all, it tries to find the package named by <var class="var">package_name</var>. If it
does not exist, an error is signaled. Then, a symbol with the supplied
<var class="var">name</var> is created and interned in the given package.
</p>
</dd></dl>
<ul class="mini-toc">
<li><a href="Symbols.html#ANSI-Dictionary-5" accesskey="1">ANSI Dictionary</a></li>
</ul>
<div class="subsubsection-level-extent" id="ANSI-Dictionary-5">
<h4 class="subsubsection">2.8.1.1 ANSI Dictionary</h4>
<p>Common Lisp and C equivalence
</p>
<table class="multitable">
<thead><tr><th width="30%">Lisp symbol</th><th width="70%">C function</th></tr></thead>
<tbody><tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_boundp.htm">boundp</a></td><td width="70%">cl_object cl_boundp(cl_object symbolp)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_cp_sym.htm">copy-symbol</a></td><td width="70%">cl_object cl_copy_symbol(cl_narg narg, cl_object symbol, ...)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_get.htm">get</a></td><td width="70%">cl_object cl_get(cl_narg narg, cl_object sym, cl_object indicator, ...)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_gensym.htm">gensym</a></td><td width="70%">cl_object cl_gensym(cl_narg narg, ...)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_gentem.htm">gentemp</a></td><td width="70%">cl_object cl_gentemp(cl_narg narg, ...)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_kwdp.htm">keywordp</a></td><td width="70%">cl_object cl_keywordp(cl_object object)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_mk_sym.htm">make-symbol</a></td><td width="70%">cl_object cl_make_symbol(cl_object name)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_makunb.htm">makunbound</a></td><td width="70%">cl_object cl_makunbound(cl_object makunbound)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_rempro.htm">remprop</a></td><td width="70%">cl_object cl_remprop(cl_object symbol, cl_object indicator)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_set.htm">set</a></td><td width="70%">cl_object cl_set(cl_object symbol, cl_object value)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_symbol.htm">symbolp</a></td><td width="70%">cl_object cl_symbolp(cl_object object)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_symb_1.htm">symbol-function</a></td><td width="70%">cl_object cl_symbol_function(cl_object symbol)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_symb_1.htm">(setf symbol-function)</a></td><td width="70%">cl_object si_fset(cl_narg narg, cl_object function_name, cl_object definition, ...)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_symb_2.htm">symbol-name</a></td><td width="70%">cl_object cl_symbol_name(cl_object symbol)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_symb_3.htm">symbol-package</a></td><td width="70%">cl_object cl_symbol_package(cl_object symbol)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_symb_4.htm">symbol-plist</a></td><td width="70%">cl_object cl_symbol_plist(cl_object symbol)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_symb_4.htm">(setf symbol-plist)</a></td><td width="70%">cl_object si_set_symbol_plist(cl_object symbol, cl_object plist)</td></tr>
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_symb_5.htm">symbol-value</a></td><td width="70%">cl_object cl_symbol_value(cl_object symbol)</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Packages.html" accesskey="n" rel="next">Packages</a>, Previous: <a href="Conditions.html" accesskey="p" rel="prev">Conditions</a>, Up: <a href="Standards.html" accesskey="u" rel="up">Standards</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indexes.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>