<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="Generator" content="Microsoft Word 97"><title>Page Layouts -
Single column, centre aligned, set width</title>
<style type="text/css" media="screen"><!--
body
{
padding: 0;
margin: 0;
background-color: #666;
color: #000;
text-align: center;
}
#contents
{
margin-top: 10px;
margin-bottom: 10px;
margin-right:auto;
margin-left:auto;
width: 600px;
padding: 10px;
background-color: #FFF;
color: #000;
text-align: left;
}
h1, h2, h3
{
color: #333;
background-color: transparent;
font-family: Arial, Helvetica, sans-serif;
}
h1 { font-size: 30px; }
h2 { font-size: 20px; }
h3 { font-size: 15px; }
p
{
color: #333;
background-color: transparent;
font-family: Arial, Helvetica, sans-serif;
font-size: 0.8em;
}
.code
{
color: #339;
background-color: transparent;
font-family: times, serif;
font-size: 0.9em;
padding-left: 40px;
}
--></style></head><body link="#0000ff" vlink="#800080">
<p></p>
<div id="contents"><b><font face="Arial" size="4">libunicode
</font></b><p style="text-align: justify;">This library is intended for
unicode-intensive applications. Its text model revives the SRC Modula-3
one, but with a twist: A text, called "string" here, is a reference to
an array of UTF-8 encoded Unicode code points. This has the advantage
that the address of its first byte may be handed over to foreign
libraries, as long as it remains on the stack, this all the more
knowing that many modern libraries (e.g. "glib") use UTF-8 encoded text
internally.</p>
<p style="text-align: justify;">The library is divided into five parts:</p>
<p><span style="font-weight: bold;">1. Properties</span></p>
<p style="text-align: justify;">This part deals with properties of
Unicode code-points/characters. We call Unicode code-points "runes" for
brevity. Unlike WIDECHAR's, runes cover the the whole gamut of the
Unicode specification. We could have defined a Rune as <big><code>TYPE Rune
= [0..16_10FFFF]</code></big>, but
unfortunately not all values in the code-point range are valid and
others are left undefined, so a "Rune" is defined as an integer. The
library uses defensive programming by not allowing a string to contain
any invalid or undefined Rune.<br>
</p>
<p style="font-weight: bold;">2. Codecs</p>
<p>Coding and decoding of runes to and from UTF-8.<br>
</p>
<p style="font-weight: bold;">3. Reader/Writer</p>
<p>Reading and writing of runes and strings.<br>
</p>
<p style="font-weight: bold;">4. Unicode strings</p>
<p style="text-align: justify;">A "String.T" is an immutable,
NUL-terminated, sequence of UTF-8 encoded runes. Internally the
trailing NUL byte is followed by a "delta" encoded into one, two, or
four bytes, where delta is the difference between the number of encoded
runes and the number of bytes required for the encoding. The trailing
NUL byte is not taken into account when calculating delta. This allows
(unlike SRC M3) to report the length of a string in constant time and
also to check wether a string is ASCII only (delta = 0).</p>
<p style="text-align: justify;">The library includes a "StrBuf" module to
incrementally build strings by appending runes or other strings.</p>
<p style="text-align: justify;">Our text model could ultimately replace
the existing M3 text implementation if popular enough. Meanwhile it
includes a "StrCvt" module to allow conversions between strings and
TEXT.</p>
<p style="text-align: justify;"><span style="font-weight: bold;">5. An XML
1.0 parser</span></p>
<p style="text-align: justify;">The library includes a simple, namespace
aware parser for XML 1.0 documents.</p>
<p style="text-align: justify; font-weight: bold;">License</p>
<p style="text-align: justify;">Some parts of this library, and mainly
the parts related to character properties and XML, while not identical,
owe a lot to their corresponding implementation in the <a
href="http://golang.org/">Go</a> language. So we use the same BSD-style
license as <a href="http://golang.org/LICENSE">golang</a>.</p>
<pre><span class="ln"></span>Copyright (c) 2009 The Go Authors. All rights
reserved.<br>Portions Copyright (c) 2011 Dirk Muysers <dmuysers at
hotmail dot com><br><span class="ln"></span> <br><span
class="ln"></span>Redistribution and use in source and binary forms, with or
without<br><span class="ln"></span>modification, are permitted provided that
the following conditions are<br><span class="ln"></span>met:<br><br><span
class="ln"></span><span class="ln"></span> * Redistributions of source
code must retain the above copyright<br><span class="ln"></span> notice,
this list of conditions and the following disclaimer.<br><br><span
class="ln"> </span>* Redistributions in binary form must reproduce the
above<br><span class="ln"> </span> copyright notice, this list of
conditions and the following disclaimer<br><span class="ln"> </span> in
the documentation and/or other materials provided with the<br><span
class="ln"> </span> distribution.<br><span class="ln"><br> </span>*
Neither the name of Google Inc. nor the names of its<br><span class="ln">
</span> contributors may be used to endorse or promote products derived
from<br><span class="ln"> </span> this software without specific prior
written permission.<br><span class="ln"></span> <br><span
class="ln"></span>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS<br><span class="ln"></span>"AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT<br><span class="ln"></span>LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR<br><span
class="ln"></span>A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT<br><span class="ln"></span>OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL,<br><span class="ln"></span>SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT<br><span
class="ln"></span>LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE,<br><span class="ln"></span>DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY<br><span class="ln"></span>THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT<br><span
class="ln"></span>(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE<br><span class="ln"></span>OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.</pre>
<p><span style="font-weight: bold;"><span style="font-weight:
bold;"></span></span></p>
</div><br>
</body></html>