1 .\" $Id: mchars_alloc.3,v 1.3 2015/10/13 22:59:54 schwarze Exp $
3 .\" Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .Dd $Mdocdate: October 13 2015 $
27 .Nd character table for mandoc
37 .Fa "const char *decimal"
42 .Fa "const char *hexadecimal"
47 .Fa "const char *name"
52 .Fa "const char *name"
57 .Fn mchars_uc2str "int codepoint"
59 These functions translate Unicode character numbers and
61 character names into glyphs.
67 These functions are intended for external use by programs formatting
71 pages for output, for example the
73 output formatter modules and
81 input arguments are usually obtained from the
89 string representation of a character number consisting of
91 digits into a printable ASCII character.
92 If the input string is non-numeric or does not represent a printable
93 ASCII character, the NUL character
102 output modules use this function to render
111 string representation of a Unicode codepoint consisting of
113 digits into an integer representation.
114 If the input string is non-numeric or represents an ASCII character,
123 output modules use this function to render
125 .Ic \e[u Ns Ar XXXX Ns Ic \&]
127 .Ic \eC\(aqu Ns Ar XXXX Ns Ic \(aq
134 object for subsequent use by the following two lookup functions.
135 When no longer needed, this object can be destroyed with
146 characters and returns the corresponding Unicode codepoint.
149 is not recognized, \-1 is returned.
155 output modules use this function to render
157 .Ic \e[ Ns Ar name Ns Ic \&]
159 .Ic \eC\(aq Ns Ar name Ns Ic \(aq
170 characters and returns an ASCII string representation.
171 The length of the representation is returned in
173 In many cases, the meaning of such ASCII representations
174 is not quite obvious, so using
176 special characters in documents intended for ASCII rendering
177 is usually a bad idea.
188 output module use this function to render
190 .Ic \e[ Ns Ar name Ns Ic \&]
192 .Ic \eC\(aq Ns Ar name Ns Ic \(aq
197 performs a reverse lookup of the Unicode
199 and returns an ASCII string representation, or the string
201 if none is available.
203 These funtions are implemented in the file
207 .Xr mandoc_escape 3 ,
212 These functions and their predecessors have been available since the
213 following mandoc versions:
214 .Bl -column "mchars_num2char()" "1.11.3" "chars_num2char()" "1.10.10"
215 .It Sy function Ta since Ta Sy predecessor Ta since
216 .It Fn mchars_alloc Ta 1.11.3 Ta Fn ascii2htab Ta 1.5.3
217 .It Fn mchars_free Ta 1.11.2 Ta Fn asciifree Ta 1.6.0
218 .It Fn mchars_num2char Ta 1.11.2 Ta Fn chars_num2char Ta 1.10.10
219 .It Fn mchars_num2uc Ta 1.11.3 Ta \(em Ta \(em
220 .It Fn mchars_spec2cp Ta 1.11.2 Ta Fn chars_spec2cp Ta 1.10.5
221 .It Fn mchars_spec2str Ta 1.11.2 Ta Fn a2ascii Ta 1.5.3
222 .It Fn mchars_uc2str Ta 1.13.2 Ta \(em Ta \(em
225 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
226 .An Ingo Schwarze Aq Mt schwarze@openbsd.org