139 lines
6.4 KiB
HTML
139 lines
6.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<!-- This manual documents Guile version 3.0.10.
|
|
|
|
Copyright (C) 1996-1997, 2000-2005, 2009-2023 Free Software Foundation,
|
|
Inc.
|
|
|
|
Copyright (C) 2021 Maxime Devos
|
|
|
|
Copyright (C) 2024 Tomas Volf
|
|
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
|
any later version published by the Free Software Foundation; with no
|
|
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
|
|
copy of the license is included in the section entitled "GNU Free
|
|
Documentation License." -->
|
|
<title>String Internals (Guile Reference Manual)</title>
|
|
|
|
<meta name="description" content="String Internals (Guile Reference Manual)">
|
|
<meta name="keywords" content="String Internals (Guile Reference Manual)">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content=".texi2any-real">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
|
|
<link href="index.html" rel="start" title="Top">
|
|
<link href="Concept-Index.html" rel="index" title="Concept Index">
|
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
|
<link href="Strings.html" rel="up" title="Strings">
|
|
<link href="Conversion-to_002ffrom-C.html" rel="prev" title="Conversion to/from C">
|
|
<style type="text/css">
|
|
<!--
|
|
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
|
|
span:hover a.copiable-link {visibility: visible}
|
|
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
|
|
-->
|
|
</style>
|
|
<link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css">
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en">
|
|
<div class="subsubsection-level-extent" id="String-Internals">
|
|
<div class="nav-panel">
|
|
<p>
|
|
Previous: <a href="Conversion-to_002ffrom-C.html" accesskey="p" rel="prev">Conversion to/from C</a>, Up: <a href="Strings.html" accesskey="u" rel="up">Strings</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<hr>
|
|
<h4 class="subsubsection" id="String-Internals-1"><span>6.6.5.15 String Internals<a class="copiable-link" href="#String-Internals-1"> ¶</a></span></h4>
|
|
|
|
<p>Guile stores each string in memory as a contiguous array of Unicode code
|
|
points along with an associated set of attributes. If all of the code
|
|
points of a string have an integer range between 0 and 255 inclusive,
|
|
the code point array is stored as one byte per code point: it is stored
|
|
as an ISO-8859-1 (aka Latin-1) string. If any of the code points of the
|
|
string has an integer value greater that 255, the code point array is
|
|
stored as four bytes per code point: it is stored as a UTF-32 string.
|
|
</p>
|
|
<p>Conversion between the one-byte-per-code-point and
|
|
four-bytes-per-code-point representations happens automatically as
|
|
necessary.
|
|
</p>
|
|
<p>No API is provided to set the internal representation of strings;
|
|
however, there are pair of procedures available to query it. These are
|
|
debugging procedures. Using them in production code is discouraged,
|
|
since the details of Guile’s internal representation of strings may
|
|
change from release to release.
|
|
</p>
|
|
<dl class="first-deffn">
|
|
<dt class="deffn" id="index-string_002dbytes_002dper_002dchar"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">string-bytes-per-char</strong> <var class="def-var-arguments">str</var><a class="copiable-link" href="#index-string_002dbytes_002dper_002dchar"> ¶</a></span></dt>
|
|
<dt class="deffnx def-cmd-deffn" id="index-scm_005fstring_005fbytes_005fper_005fchar"><span class="category-def">C Function: </span><span><strong class="def-name">scm_string_bytes_per_char</strong> <var class="def-var-arguments">(str)</var><a class="copiable-link" href="#index-scm_005fstring_005fbytes_005fper_005fchar"> ¶</a></span></dt>
|
|
<dd><p>Return the number of bytes used to encode a Unicode code point in string
|
|
<var class="var">str</var>. The result is one or four.
|
|
</p></dd></dl>
|
|
|
|
<dl class="first-deffn">
|
|
<dt class="deffn" id="index-_0025string_002ddump"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">%string-dump</strong> <var class="def-var-arguments">str</var><a class="copiable-link" href="#index-_0025string_002ddump"> ¶</a></span></dt>
|
|
<dt class="deffnx def-cmd-deffn" id="index-scm_005fsys_005fstring_005fdump"><span class="category-def">C Function: </span><span><strong class="def-name">scm_sys_string_dump</strong> <var class="def-var-arguments">(str)</var><a class="copiable-link" href="#index-scm_005fsys_005fstring_005fdump"> ¶</a></span></dt>
|
|
<dd><p>Returns an association list containing debugging information for
|
|
<var class="var">str</var>. The association list has the following entries.
|
|
</p><dl class="table">
|
|
<dt><code class="code">string</code></dt>
|
|
<dd><p>The string itself.
|
|
</p>
|
|
</dd>
|
|
<dt><code class="code">start</code></dt>
|
|
<dd><p>The start index of the string into its stringbuf
|
|
</p>
|
|
</dd>
|
|
<dt><code class="code">length</code></dt>
|
|
<dd><p>The length of the string
|
|
</p>
|
|
</dd>
|
|
<dt><code class="code">shared</code></dt>
|
|
<dd><p>If this string is a substring, it returns its
|
|
parent string. Otherwise, it returns <code class="code">#f</code>
|
|
</p>
|
|
</dd>
|
|
<dt><code class="code">read-only</code></dt>
|
|
<dd><p><code class="code">#t</code> if the string is read-only
|
|
</p>
|
|
</dd>
|
|
<dt><code class="code">stringbuf-chars</code></dt>
|
|
<dd><p>A new string containing this string’s stringbuf’s characters
|
|
</p>
|
|
</dd>
|
|
<dt><code class="code">stringbuf-length</code></dt>
|
|
<dd><p>The number of characters in this stringbuf
|
|
</p>
|
|
</dd>
|
|
<dt><code class="code">stringbuf-shared</code></dt>
|
|
<dd><p><code class="code">#t</code> if this stringbuf is shared
|
|
</p>
|
|
</dd>
|
|
<dt><code class="code">stringbuf-wide</code></dt>
|
|
<dd><p><code class="code">#t</code> if this stringbuf’s characters are stored in a 32-bit buffer,
|
|
or <code class="code">#f</code> if they are stored in an 8-bit buffer
|
|
</p></dd>
|
|
</dl>
|
|
</dd></dl>
|
|
|
|
|
|
</div>
|
|
<hr>
|
|
<div class="nav-panel">
|
|
<p>
|
|
Previous: <a href="Conversion-to_002ffrom-C.html">Conversion to/from C</a>, Up: <a href="Strings.html">Strings</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|