1 .\" $Id: mchars_alloc.3,v 1.4 2016/07/07 19:19:01 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: July 7 2016 $
28 .Nd character table for mandoc
38 .Fa "const char *decimal"
43 .Fa "const char *hexadecimal"
48 .Fa "const char *name"
53 .Fa "const char *name"
58 .Fn mchars_uc2str "int codepoint"
60 These functions translate Unicode character numbers and
62 character names into glyphs.
68 These functions are intended for external use by programs formatting
72 pages for output, for example the
74 output formatter modules and
82 input arguments are usually obtained from the
90 string representation of a character number consisting of
92 digits into a printable ASCII character.
93 If the input string is non-numeric or does not represent a printable
94 ASCII character, the NUL character
103 output modules use this function to render
112 string representation of a Unicode codepoint consisting of
114 digits into an integer representation.
115 If the input string is non-numeric or represents an ASCII character,
124 output modules use this function to render
126 .Ic \e[u Ns Ar XXXX Ns Ic \&]
128 .Ic \eC\(aqu Ns Ar XXXX Ns Ic \(aq
135 object for subsequent use by the following two lookup functions.
136 When no longer needed, this object can be destroyed with
147 characters and returns the corresponding Unicode codepoint.
150 is not recognized, \-1 is returned.
156 output modules use this function to render
158 .Ic \e[ Ns Ar name Ns Ic \&]
160 .Ic \eC\(aq Ns Ar name Ns Ic \(aq
171 characters and returns an ASCII string representation.
172 The length of the representation is returned in
174 In many cases, the meaning of such ASCII representations
175 is not quite obvious, so using
177 special characters in documents intended for ASCII rendering
178 is usually a bad idea.
189 output module use this function to render
191 .Ic \e[ Ns Ar name Ns Ic \&]
193 .Ic \eC\(aq Ns Ar name Ns Ic \(aq
198 performs a reverse lookup of the Unicode
200 and returns an ASCII string representation, or the string
202 if none is available.
204 These funtions are implemented in the file
208 .Xr mandoc_escape 3 ,
213 These functions and their predecessors have been available since the
214 following mandoc versions:
215 .Bl -column "mchars_num2char()" "1.11.3" "chars_num2char()" "1.10.10"
216 .It Sy function Ta since Ta Sy predecessor Ta since
217 .It Fn mchars_alloc Ta 1.11.3 Ta Fn ascii2htab Ta 1.5.3
218 .It Fn mchars_free Ta 1.11.2 Ta Fn asciifree Ta 1.6.0
219 .It Fn mchars_num2char Ta 1.11.2 Ta Fn chars_num2char Ta 1.10.10
220 .It Fn mchars_num2uc Ta 1.11.3 Ta \(em Ta \(em
221 .It Fn mchars_spec2cp Ta 1.11.2 Ta Fn chars_spec2cp Ta 1.10.5
222 .It Fn mchars_spec2str Ta 1.11.2 Ta Fn a2ascii Ta 1.5.3
223 .It Fn mchars_uc2str Ta 1.13.2 Ta \(em Ta \(em
226 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
227 .An Ingo Schwarze Aq Mt schwarze@openbsd.org