1 .\" $Id: mchars_alloc.3,v 1.2 2014/10/26 18:07:28 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 26 2014 $
27 .Nd character table for mandoc
34 .Fn mchars_alloc "void"
37 .Fa "struct mchars *table"
41 .Fa "const char *decimal"
46 .Fa "const char *hexadecimal"
51 .Fa "const struct mchars *table"
52 .Fa "const char *name"
57 .Fa "const struct mchars *table"
58 .Fa "const char *name"
63 .Fn mchars_uc2str "int codepoint"
65 These functions translate Unicode character numbers and
67 character names into glyphs.
73 These functions are intended for external use by programs formatting
77 pages for output, for example the
79 output formatter modules and
87 input arguments are usually obtained from the
95 string representation of a character number consisting of
97 digits into a printable ASCII character.
98 If the input string is non-numeric or does not represent a printable
99 ASCII character, the NUL character
108 output modules use this function to render
117 string representation of a Unicode codepoint consisting of
119 digits into an integer representation.
120 If the input string is non-numeric or represents an ASCII character,
129 output modules use this function to render
131 .Ic \e[u Ns Ar XXXX Ns Ic \&]
133 .Ic \eC\(aqu Ns Ar XXXX Ns Ic \(aq
139 .Vt "struct mchars *"
140 table object for subsequent use by the following two lookup functions.
141 When no longer needed, this object can be destroyed with
154 and returns the corresponding Unicode codepoint.
157 is not recognized, \-1 is returned.
163 output modules use this function to render
165 .Ic \e[ Ns Ar name Ns Ic \&]
167 .Ic \eC\(aq Ns Ar name Ns Ic \(aq
180 and returns an ASCII string representation.
181 The length of the representation is returned in
183 In many cases, the meaning of such ASCII representations
184 is not quite obvious, so using
186 special characters in documents intended for ASCII rendering
187 is usually a bad idea.
198 output module use this function to render
200 .Ic \e[ Ns Ar name Ns Ic \&]
202 .Ic \eC\(aq Ns Ar name Ns Ic \(aq
207 performs a reverse lookup of the Unicode
209 and returns an ASCII string representation, or the string
211 if none is available.
213 These funtions are implemented in the file
217 .Xr mandoc_escape 3 ,
221 These functions and their predecessors have been available since the
222 following mandoc versions:
223 .Bl -column "mchars_num2char()" "1.11.3" "chars_num2char()" "1.10.10"
224 .It Sy function Ta since Ta Sy predecessor Ta since
225 .It Fn mchars_alloc Ta 1.11.3 Ta Fn ascii2htab Ta 1.5.3
226 .It Fn mchars_free Ta 1.11.2 Ta Fn asciifree Ta 1.6.0
227 .It Fn mchars_num2char Ta 1.11.2 Ta Fn chars_num2char Ta 1.10.10
228 .It Fn mchars_num2uc Ta 1.11.3 Ta \(em Ta \(em
229 .It Fn mchars_spec2cp Ta 1.11.2 Ta Fn chars_spec2cp Ta 1.10.5
230 .It Fn mchars_spec2str Ta 1.11.2 Ta Fn a2ascii Ta 1.5.3
231 .It Fn mchars_uc2str Ta 1.13.2 Ta \(em Ta \(em
234 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
235 .An Ingo Schwarze Aq Mt schwarze@openbsd.org