| 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> |
| 8 | <title>Characters</title> |
| 9 | <section xml:id="ansi.characters.c-dict"> |
| 10 | <title>C Reference</title> |
| 11 | <refentry xml:id="ansi.characters.c-types"> |
| 12 | <refnamediv> |
| 13 | <refname>C types</refname> |
| 14 | <refpurpose>C character types</refpurpose> |
| 15 | </refnamediv> |
| 16 | |
| 17 | <refsynopsisdiv> |
| 18 | <title>Type names</title> |
| 19 | <simplelist columns="2" type="horiz"> |
| 20 | <member><type>ecl_character</type></member> |
| 21 | <member><type>character</type></member> |
| 22 | |
| 23 | <member><type>ecl_base_char</type></member> |
| 24 | <member><type>base-char</type></member> |
| 25 | </simplelist> |
| 26 | </refsynopsisdiv> |
| 27 | |
| 28 | <refsect1> |
| 29 | <title>Description</title> |
| 30 | |
| 31 | <para>&ECL; defines two C types to hold its characters: <type>ecl_base_char</type> and <type>ecl_character</type>.</para> |
| 32 | <itemizedlist> |
| 33 | <listitem><para>When &ECL; is built without Unicode, they both coincide and typically match <type>unsigned char</type>, to cover the 256 codes that are needed.</para></listitem> |
| 34 | <listitem><para>When &ECL; is built with Unicode, the two types are no longer equivalent, with <type>ecl_character</type> being larger.</para></listitem> |
| 35 | </itemizedlist> |
| 36 | |
| 37 | <para>For your code to be portable and future proof, use both types to really express what you intend to do.</para> |
| 38 | </refsect1> |
| 39 | </refentry> |
| 40 | |
| 41 | <refentry> |
| 42 | <refnamediv> |
| 43 | <refname>Constructors</refname> |
| 44 | <refpurpose>Creating and extracting characters from Lisp objects</refpurpose> |
| 45 | </refnamediv> |
| 46 | |
| 47 | <refsynopsisdiv> |
| 48 | <title>Functions and macros</title> |
| 49 | <funcsynopsis> |
| 50 | <funcprototype> |
| 51 | <?dbhtml funcsynopsis-style='ansi'?> |
| 52 | <funcdef>cl_object <function>ECL_CODE_CHAR</function></funcdef> |
| 53 | <paramdef><type>ecl_character</type> <parameter>code</parameter></paramdef> |
| 54 | </funcprototype> |
| 55 | </funcsynopsis> |
| 56 | |
| 57 | <funcsynopsis> |
| 58 | <funcprototype> |
| 59 | <?dbhtml funcsynopsis-style='ansi'?> |
| 60 | <funcdef>ecl_character <function>ECL_CHAR_CODE</function></funcdef> |
| 61 | <paramdef><type>cl_object</type> <parameter>o</parameter></paramdef> |
| 62 | </funcprototype> |
| 63 | </funcsynopsis> |
| 64 | |
| 65 | <funcsynopsis> |
| 66 | <funcprototype> |
| 67 | <?dbhtml funcsynopsis-style='ansi'?> |
| 68 | <funcdef>cl_object <function>ecl_char_code</function></funcdef> |
| 69 | <paramdef><type>ecl_character</type> <parameter>code</parameter></paramdef> |
| 70 | </funcprototype> |
| 71 | </funcsynopsis> |
| 72 | |
| 73 | <funcsynopsis> |
| 74 | <funcprototype> |
| 75 | <?dbhtml funcsynopsis-style='ansi'?> |
| 76 | <funcdef>ecl_base_char <function>ecl_base_char_code</function></funcdef> |
| 77 | <paramdef><type>cl_object</type> <parameter>o</parameter></paramdef> |
| 78 | </funcprototype> |
| 79 | </funcsynopsis> |
| 80 | </refsynopsisdiv> |
| 81 | |
| 82 | <refsect1> |
| 83 | <title>Description</title> |
| 84 | <para>These functions and macros convert back and forth from C character types to Lisp. The macros <function>ECL_CHAR_CODE</function> and <function>ECL_CODE_CHAR</function> perform this coercion without checking the arguments. The functions <function>ecl_char_code</function> and <function>ecl_base_char_code</function>, on the other hand, verify that the argument has the right type and signal an error otherwise.</para> |
| 85 | </refsect1> |
| 86 | </refentry> |
| 87 | |
| 88 | <refentry> |
| 89 | <refnamediv> |
| 90 | <refname>Predicates</refname> |
| 91 | <refpurpose>C predicates for Lisp characters</refpurpose> |
| 92 | </refnamediv> |
| 93 | |
| 94 | <refsynopsisdiv> |
| 95 | <title>Functions and macros</title> |
| 96 | <funcsynopsis> |
| 97 | <funcprototype> |
| 98 | <?dbhtml funcsynopsis-style='ansi'?> |
| 99 | <funcdef>bool <function>ecl_base_char_p</function></funcdef> |
| 100 | <paramdef><type>ecl_character</type> <parameter>c</parameter></paramdef> |
| 101 | </funcprototype> |
| 102 | </funcsynopsis> |
| 103 | |
| 104 | <funcsynopsis> |
| 105 | <funcprototype> |
| 106 | <?dbhtml funcsynopsis-style='ansi'?> |
| 107 | <funcdef>bool <function>ecl_alpha_char_p</function></funcdef> |
| 108 | <paramdef><type>ecl_character</type> <parameter>c</parameter></paramdef> |
| 109 | </funcprototype> |
| 110 | </funcsynopsis> |
| 111 | |
| 112 | <funcsynopsis> |
| 113 | <funcprototype> |
| 114 | <?dbhtml funcsynopsis-style='ansi'?> |
| 115 | <funcdef>bool <function>ecl_alphanumeric_p</function></funcdef> |
| 116 | <paramdef><type>ecl_character</type> <parameter>c</parameter></paramdef> |
| 117 | </funcprototype> |
| 118 | </funcsynopsis> |
| 119 | |
| 120 | <funcsynopsis> |
| 121 | <funcprototype> |
| 122 | <?dbhtml funcsynopsis-style='ansi'?> |
| 123 | <funcdef>bool <function>ecl_graphic_char_p</function></funcdef> |
| 124 | <paramdef><type>ecl_character</type> <parameter>c</parameter></paramdef> |
| 125 | </funcprototype> |
| 126 | </funcsynopsis> |
| 127 | |
| 128 | <funcsynopsis> |
| 129 | <funcprototype> |
| 130 | <?dbhtml funcsynopsis-style='ansi'?> |
| 131 | <funcdef>bool <function>ecl_digit_p</function></funcdef> |
| 132 | <paramdef><type>ecl_character</type> <parameter>c</parameter></paramdef> |
| 133 | </funcprototype> |
| 134 | </funcsynopsis> |
| 135 | |
| 136 | <funcsynopsis> |
| 137 | <funcprototype> |
| 138 | <?dbhtml funcsynopsis-style='ansi'?> |
| 139 | <funcdef>bool <function>ecl_standard_char_p</function></funcdef> |
| 140 | <paramdef><type>ecl_character</type> <parameter>c</parameter></paramdef> |
| 141 | </funcprototype> |
| 142 | </funcsynopsis> |
| 143 | </refsynopsisdiv> |
| 144 | |
| 145 | <refsect1> |
| 146 | <title>Description</title> |
| 147 | <para>These functions are equivalent to their Lisp equivalents but return C booleans.</para> |
| 148 | </refsect1> |
| 149 | </refentry> |
| 150 | |
| 151 | <refentry> |
| 152 | <refnamediv> |
| 153 | <refname>Character case</refname> |
| 154 | <refpurpose>C functions related to the character case</refpurpose> |
| 155 | </refnamediv> |
| 156 | |
| 157 | <refsynopsisdiv> |
| 158 | <title>Functions and macros</title> |
| 159 | <funcsynopsis> |
| 160 | <funcprototype> |
| 161 | <?dbhtml funcsynopsis-style='ansi'?> |
| 162 | <funcdef>bool <function>ecl_upper_case_p</function></funcdef> |
| 163 | <paramdef><type>ecl_character</type> <parameter>c</parameter></paramdef> |
| 164 | </funcprototype> |
| 165 | </funcsynopsis> |
| 166 | |
| 167 | <funcsynopsis> |
| 168 | <funcprototype> |
| 169 | <?dbhtml funcsynopsis-style='ansi'?> |
| 170 | <funcdef>bool <function>ecl_lower_case_p</function></funcdef> |
| 171 | <paramdef><type>ecl_character</type> <parameter>c</parameter></paramdef> |
| 172 | </funcprototype> |
| 173 | </funcsynopsis> |
| 174 | |
| 175 | <funcsynopsis> |
| 176 | <funcprototype> |
| 177 | <?dbhtml funcsynopsis-style='ansi'?> |
| 178 | <funcdef>bool <function>ecl_both_case_p</function></funcdef> |
| 179 | <paramdef><type>ecl_character</type> <parameter>c</parameter></paramdef> |
| 180 | </funcprototype> |
| 181 | </funcsynopsis> |
| 182 | |
| 183 | <funcsynopsis> |
| 184 | <funcprototype> |
| 185 | <?dbhtml funcsynopsis-style='ansi'?> |
| 186 | <funcdef>ecl_character <function>ecl_char_downcase</function></funcdef> |
| 187 | <paramdef><type>ecl_character</type> <parameter>c</parameter></paramdef> |
| 188 | </funcprototype> |
| 189 | </funcsynopsis> |
| 190 | |
| 191 | <funcsynopsis> |
| 192 | <funcprototype> |
| 193 | <?dbhtml funcsynopsis-style='ansi'?> |
| 194 | <funcdef>ecl_character <function>ecl_char_upcase</function></funcdef> |
| 195 | <paramdef><type>ecl_character</type> <parameter>c</parameter></paramdef> |
| 196 | </funcprototype> |
| 197 | </funcsynopsis> |
| 198 | </refsynopsisdiv> |
| 199 | |
| 200 | <refsect1> |
| 201 | <title>Description</title> |
| 202 | <para>These functions check or change the case of a character. Note that in an Unicode context, the output of these functions might not be accurate (for instance when the uppercase character has two or more codepoints).</para> |
| 203 | </refsect1> |
| 204 | </refentry> |
| 205 | |
| 206 | <refentry> |
| 207 | <refnamediv> |
| 208 | <refname>ANSI Dictionary</refname> |
| 209 | <refpurpose>&ANSI-C-Dict;</refpurpose> |
| 210 | </refnamediv> |
| 211 | |
| 212 | <refsynopsisdiv> |
| 213 | <simplelist columns="2" type="horiz"> |
| 214 | <member>Lisp symbol</member> |
| 215 | <member>C function</member> |
| 216 | |
| 217 | <member><ulink url="&clhs;f_chareq.htm"><symbol>char=</symbol></ulink></member> |
| 218 | <member><code>cl_object cl_charE(cl_narg narg, ...)</code></member> |
| 219 | |
| 220 | <member><ulink url="&clhs;f_chareq.htm"><symbol>char/=</symbol></ulink></member> |
| 221 | <member><code>cl_object cl_charNE(cl_narg narg, ...)</code></member> |
| 222 | |
| 223 | <member><ulink url="&clhs;f_chareq.htm"><symbol>char<</symbol></ulink></member> |
| 224 | <member><code>cl_object cl_charL(cl_narg narg, ...)</code></member> |
| 225 | |
| 226 | <member><ulink url="&clhs;f_chareq.htm"><symbol>char></symbol></ulink></member> |
| 227 | <member><code>cl_object cl_charG(cl_narg narg, ...)</code></member> |
| 228 | |
| 229 | <member><ulink url="&clhs;f_chareq.htm"><symbol>char<=</symbol></ulink></member> |
| 230 | <member><code>cl_object cl_charLE(cl_narg narg, ...)</code></member> |
| 231 | |
| 232 | <member><ulink url="&clhs;f_chareq.htm"><symbol>char>=</symbol></ulink></member> |
| 233 | <member><code>cl_object cl_charGE(cl_narg narg, ...)</code></member> |
| 234 | |
| 235 | <member><ulink url="&clhs;f_chareq.htm"><symbol>char-equal</symbol></ulink></member> |
| 236 | <member><code>cl_object cl_char_equal(cl_narg narg, ...)</code></member> |
| 237 | |
| 238 | <member><ulink url="&clhs;f_chareq.htm"><symbol>char-not-equal</symbol></ulink></member> |
| 239 | <member><code>cl_object cl_char_not_equal(cl_narg narg, ...)</code></member> |
| 240 | |
| 241 | <member><ulink url="&clhs;f_chareq.htm"><symbol>char-lessp</symbol></ulink></member> |
| 242 | <member><code>cl_object cl_char_lessp(cl_narg narg, ...)</code></member> |
| 243 | |
| 244 | <member><ulink url="&clhs;f_chareq.htm"><symbol>char-greaterp</symbol></ulink></member> |
| 245 | <member><code>cl_object cl_char_greaterp(cl_narg narg, ...)</code></member> |
| 246 | |
| 247 | <member><ulink url="&clhs;f_chareq.htm"><symbol>char-not-greaterp</symbol></ulink></member> |
| 248 | <member><code>cl_object cl_char_not_greaterp(cl_narg narg, ...)</code></member> |
| 249 | |
| 250 | <member><ulink url="&clhs;f_chareq.htm"><symbol>char-not-lessp</symbol></ulink></member> |
| 251 | <member><code>cl_object cl_char_not_lessp(cl_narg narg, ...)</code></member> |
| 252 | |
| 253 | <member><ulink url="&clhs;f_ch.htm"><symbol>character</symbol></ulink></member> |
| 254 | <member><code>cl_object cl_character(cl_object char_designator)</code></member> |
| 255 | |
| 256 | <member><ulink url="&clhs;f_chp.htm"><symbol>characterp</symbol></ulink></member> |
| 257 | <member><code>cl_object cl_characterp(cl_object object)</code></member> |
| 258 | |
| 259 | <member><ulink url="&clhs;f_alpha_.htm"><symbol>alpha-char-p</symbol></ulink></member> |
| 260 | <member><code>cl_object cl_alpha_char_p(cl_object character)</code></member> |
| 261 | |
| 262 | <member><ulink url="&clhs;f_alphan.htm"><symbol>alphanumericp</symbol></ulink></member> |
| 263 | <member><code>cl_object cl_alphanumericp(cl_object character)</code></member> |
| 264 | |
| 265 | <member><ulink url="&clhs;f_digit_.htm"><symbol>digit-char</symbol></ulink></member> |
| 266 | <member><code>cl_object cl_digit_char(cl_narg narg, cl_object character, ...)</code></member> |
| 267 | |
| 268 | <member><ulink url="&clhs;f_digi_1.htm"><symbol>digit-char-p</symbol></ulink></member> |
| 269 | <member><code>cl_object cl_digit_char_p(cl_narg narg, cl_object character, ...)</code></member> |
| 270 | |
| 271 | <member><ulink url="&clhs;f_graphi.htm"><symbol>graphic-char-p</symbol></ulink></member> |
| 272 | <member><code>cl_object cl_graphic_char_p(cl_object character)</code></member> |
| 273 | |
| 274 | <member><ulink url="&clhs;f_std_ch.htm"><symbol>standard-char-p</symbol></ulink></member> |
| 275 | <member><code>cl_object cl_standard_char_p(cl_object character)</code></member> |
| 276 | |
| 277 | <member><ulink url="&clhs;f_char_u.htm"><symbol>char_upcase</symbol></ulink></member> |
| 278 | <member><code>cl_object cl_char_upcase(cl_object character)</code></member> |
| 279 | |
| 280 | <member><ulink url="&clhs;f_char_u.htm"><symbol>char-downcase</symbol></ulink></member> |
| 281 | <member><code>cl_object cl_char_downcase(cl_object character)</code></member> |
| 282 | |
| 283 | <member><ulink url="&clhs;f_upper_.htm"><symbol>upper-case-p</symbol></ulink></member> |
| 284 | <member><code>cl_object cl_upper_case_p(cl_object character)</code></member> |
| 285 | |
| 286 | <member><ulink url="&clhs;f_upper_.htm"><symbol>lower-case-p</symbol></ulink></member> |
| 287 | <member><code>cl_object cl_lower_case_p(cl_object character)</code></member> |
| 288 | |
| 289 | <member><ulink url="&clhs;f_upper_.htm"><symbol>both-case-p</symbol></ulink></member> |
| 290 | <member><code>cl_object cl_both_case_p(cl_object character)</code></member> |
| 291 | |
| 292 | <member><ulink url="&clhs;f_char_c.htm"><symbol>char-code</symbol></ulink></member> |
| 293 | <member><code>cl_object cl_char_code(cl_object character)</code></member> |
| 294 | |
| 295 | <member><ulink url="&clhs;f_char_i.htm"><symbol>char-int</symbol></ulink></member> |
| 296 | <member><code>cl_object cl_char_int(cl_object character)</code></member> |
| 297 | |
| 298 | <member><ulink url="&clhs;f_code_c.htm"><symbol>code-char</symbol></ulink></member> |
| 299 | <member><code>cl_object cl_code_char(cl_object code)</code></member> |
| 300 | |
| 301 | <member><ulink url="&clhs;f_char_n.htm"><symbol>char-name</symbol></ulink></member> |
| 302 | <member><code>cl_object cl_char_name(cl_object character)</code></member> |
| 303 | |
| 304 | <member><ulink url="&clhs;f_name_c.htm"><symbol>name-char</symbol></ulink></member> |
| 305 | <member><code>cl_object cl_name_char(cl_object name)</code></member> |
| 306 | </simplelist> |
| 307 | </refsynopsisdiv> |
| 308 | |
| 309 | <refsect1> |
| 310 | <title>Description</title> |
| 311 | <para></para> |
| 312 | </refsect1> |
| 313 | </refentry> |
| 314 | </section> |
| 315 | </chapter> |
| 316 | </book> |