| 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <!DOCTYPE book [ |
| 3 | <!ENTITY % eclent SYSTEM "ecl.ent"> |
| 4 | %eclent; |
| 5 | ]> |
| 6 | <book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en"> |
| 7 | <chapter xml:id="ansi.strings"> |
| 8 | <title>Strings</title> |
| 9 | |
| 10 | <section xml:id="ansi.strings.types"> |
| 11 | |
| 12 | <title>String types & Unicode</title> |
| 13 | |
| 14 | <para>The &ECL; implementation of strings is ANSI Common-Lisp compliant. There are basically four string types as shown in <xref linkend="table.ansi.strings"/>. As explained in <xref linkend="ansi.characters"/>, when Unicode support is disabled, <type>character</type> and <type>base-character</type> are the same type and the last two string types are equivalent to the first two.</para> |
| 15 | <table xml:id="table.ansi.strings"> |
| 16 | <title>&CommonLisp; string types</title> |
| 17 | <tgroup cols="2"> |
| 18 | <thead> |
| 19 | <row> |
| 20 | <entry>Abbreviation</entry> |
| 21 | <entry>Expanded type</entry> |
| 22 | <entry>Remarks</entry> |
| 23 | </row> |
| 24 | </thead> |
| 25 | <tbody> |
| 26 | <row> |
| 27 | <entry><type>string</type></entry> |
| 28 | <entry><type>(array character (*))</type></entry> |
| 29 | <entry>8 or 32 bits per character, adjustable.</entry> |
| 30 | </row> |
| 31 | <row> |
| 32 | <entry><type>simple-string</type></entry> |
| 33 | <entry><type>(simple-array character (*))</type></entry> |
| 34 | <entry>8 or 32 bits per character, not adjustable nor displaced.</entry> |
| 35 | </row> |
| 36 | <row> |
| 37 | <entry><type>base-string</type></entry> |
| 38 | <entry><type>(array base-char (*))</type></entry> |
| 39 | <entry>8 bits per character, adjustable.</entry> |
| 40 | </row> |
| 41 | <row> |
| 42 | <entry><type>simple-base-string</type></entry> |
| 43 | <entry><type>(simple-array base-char (*))</type></entry> |
| 44 | <entry>8 bits per character, not adjustable nor displaced.</entry> |
| 45 | </row> |
| 46 | </tbody> |
| 47 | </tgroup> |
| 48 | </table> |
| 49 | |
| 50 | <para>It is important to remember that strings with unicode characters can only be printed readably when the external format supports those characters. If this is not the case, &ECL; will signal a <type>serious-condition</type>. This condition will abort your program if not properly handled.</para> |
| 51 | |
| 52 | </section> |
| 53 | |
| 54 | <xi:include href="ref_c_strings.xml" xpointer="ansi.strings.c-dict" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 55 | |
| 56 | </chapter> |
| 57 | </book> |