Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / man / man3 / charnames.3
CommitLineData
86530b38
AT
1.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "charnames 3"
132.TH charnames 3 "2002-06-01" "perl v5.8.0" "Perl Programmers Reference Guide"
133.SH "NAME"
134charnames \- define character names for \f(CW\*(C`\eN{named}\*(C'\fR string literal escapes
135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS"
137.Vb 2
138\& use charnames ':full';
139\& print "\eN{GREEK SMALL LETTER SIGMA} is called sigma.\en";
140.Ve
141.PP
142.Vb 2
143\& use charnames ':short';
144\& print "\eN{greek:Sigma} is an upper-case sigma.\en";
145.Ve
146.PP
147.Vb 2
148\& use charnames qw(cyrillic greek);
149\& print "\eN{sigma} is Greek sigma, and \eN{be} is Cyrillic b.\en";
150.Ve
151.PP
152.Vb 2
153\& print charnames::viacode(0x1234); # prints "ETHIOPIC SYLLABLE SEE"
154\& printf "%04X", charnames::vianame("GOTHIC LETTER AHSA"); # prints "10330"
155.Ve
156.SH "DESCRIPTION"
157.IX Header "DESCRIPTION"
158Pragma \f(CW\*(C`use charnames\*(C'\fR supports arguments \f(CW\*(C`:full\*(C'\fR, \f(CW\*(C`:short\*(C'\fR and
159script names. If \f(CW\*(C`:full\*(C'\fR is present, for expansion of
160\&\f(CW\*(C`\eN{CHARNAME}\*(C'\fR string \f(CW\*(C`CHARNAME\*(C'\fR is first looked in the list of
161standard Unicode names of chars. If \f(CW\*(C`:short\*(C'\fR is present, and
162\&\f(CW\*(C`CHARNAME\*(C'\fR has the form \f(CW\*(C`SCRIPT:CNAME\*(C'\fR, then \f(CW\*(C`CNAME\*(C'\fR is looked up
163as a letter in script \f(CW\*(C`SCRIPT\*(C'\fR. If pragma \f(CW\*(C`use charnames\*(C'\fR is used
164with script name arguments, then for \f(CW\*(C`\eN{CHARNAME}\*(C'\fR the name
165\&\f(CW\*(C`CHARNAME\*(C'\fR is looked up as a letter in the given scripts (in the
166specified order).
167.PP
168For lookup of \f(CW\*(C`CHARNAME\*(C'\fR inside a given script \f(CW\*(C`SCRIPTNAME\*(C'\fR
169this pragma looks for the names
170.PP
171.Vb 3
172\& SCRIPTNAME CAPITAL LETTER CHARNAME
173\& SCRIPTNAME SMALL LETTER CHARNAME
174\& SCRIPTNAME LETTER CHARNAME
175.Ve
176.PP
177in the table of standard Unicode names. If \f(CW\*(C`CHARNAME\*(C'\fR is lowercase,
178then the \f(CW\*(C`CAPITAL\*(C'\fR variant is ignored, otherwise the \f(CW\*(C`SMALL\*(C'\fR variant
179is ignored.
180.PP
181Note that \f(CW\*(C`\eN{...}\*(C'\fR is compile\-time, it's a special form of string
182constant used inside double-quoted strings: in other words, you cannot
183use variables inside the \f(CW\*(C`\eN{...}\*(C'\fR. If you want similar run-time
184functionality, use \fIcharnames::vianame()\fR.
185.PP
186For the C0 and C1 control characters (U+0000..U+001F, U+0080..U+009F)
187as of Unicode 3.1, there are no official Unicode names but you can use
188instead the \s-1ISO\s0 6429 names (\s-1LINE\s0 \s-1FEED\s0, \s-1ESCAPE\s0, and so forth). In
189Unicode 3.2 (as of Perl 5.8) some naming changes take place \s-1ISO\s0 6429
190has been updated, see \*(L"\s-1ALIASES\s0\*(R". Also note that the U+UU80, U+0081,
191U+0084, and U+0099 do not have names even in \s-1ISO\s0 6429.
192.PP
193Since the Unicode standard uses \*(L"U+HHHH\*(R", so can you: \*(L"\eN{U+263a}\*(R"
194is the Unicode smiley face, or \*(L"\eN{\s-1WHITE\s0 \s-1SMILING\s0 \s-1FACE\s0}\*(R".
195.SH "CUSTOM TRANSLATORS"
196.IX Header "CUSTOM TRANSLATORS"
197The mechanism of translation of \f(CW\*(C`\eN{...}\*(C'\fR escapes is general and not
198hardwired into \fIcharnames.pm\fR. A module can install custom
199translations (inside the scope which \f(CW\*(C`use\*(C'\fRs the module) with the
200following magic incantation:
201.PP
202.Vb 6
203\& use charnames (); # for $charnames::hint_bits
204\& sub import {
205\& shift;
206\& $^H |= $charnames::hint_bits;
207\& $^H{charnames} = \e&translator;
208\& }
209.Ve
210.PP
211Here \fItranslator()\fR is a subroutine which takes \f(CW\*(C`CHARNAME\*(C'\fR as an
212argument, and returns text to insert into the string instead of the
213\&\f(CW\*(C`\eN{CHARNAME}\*(C'\fR escape. Since the text to insert should be different
214in \f(CW\*(C`bytes\*(C'\fR mode and out of it, the function should check the current
215state of \f(CW\*(C`bytes\*(C'\fR\-flag as in:
216.PP
217.Vb 9
218\& use bytes (); # for $bytes::hint_bits
219\& sub translator {
220\& if ($^H & $bytes::hint_bits) {
221\& return bytes_translator(@_);
222\& }
223\& else {
224\& return utf8_translator(@_);
225\& }
226\& }
227.Ve
228.SH "charnames::viacode(code)"
229.IX Header "charnames::viacode(code)"
230Returns the full name of the character indicated by the numeric code.
231The example
232.PP
233.Vb 1
234\& print charnames::viacode(0x2722);
235.Ve
236.PP
237prints \*(L"\s-1FOUR\s0 TEARDROP-SPOKED \s-1ASTERISK\s0\*(R".
238.PP
239Returns undef if no name is known for the code.
240.PP
241This works only for the standard names, and does not yet apply
242to custom translators.
243.PP
244Notice that the name returned for of U+FEFF is \*(L"\s-1ZERO\s0 \s-1WIDTH\s0 NO-BREAK
245\&\s-1SPACE\s0\*(R", not \*(L"\s-1BYTE\s0 \s-1ORDER\s0 \s-1MARK\s0\*(R".
246.SH "charnames::vianame(name)"
247.IX Header "charnames::vianame(name)"
248Returns the code point indicated by the name.
249The example
250.PP
251.Vb 1
252\& printf "%04X", charnames::vianame("FOUR TEARDROP-SPOKED ASTERISK");
253.Ve
254.PP
255prints \*(L"2722\*(R".
256.PP
257Returns undef if the name is unknown.
258.PP
259This works only for the standard names, and does not yet apply
260to custom translators.
261.SH "ALIASES"
262.IX Header "ALIASES"
263A few aliases have been defined for convenience: instead of having
264to use the official names
265.PP
266.Vb 4
267\& LINE FEED (LF)
268\& FORM FEED (FF)
269\& CARRIAGE RETURN (CR)
270\& NEXT LINE (NEL)
271.Ve
272.PP
273(yes, with parentheses) one can use
274.PP
275.Vb 8
276\& LINE FEED
277\& FORM FEED
278\& CARRIAGE RETURN
279\& NEXT LINE
280\& LF
281\& FF
282\& CR
283\& NEL
284.Ve
285.PP
286One can also use
287.PP
288.Vb 2
289\& BYTE ORDER MARK
290\& BOM
291.Ve
292.PP
293and
294.PP
295.Vb 2
296\& ZWNJ
297\& ZWJ
298.Ve
299.PP
300for \s-1ZERO\s0 \s-1WIDTH\s0 NON-JOINER and \s-1ZERO\s0 \s-1WIDTH\s0 \s-1JOINER\s0.
301.PP
302For backward compatibility one can use the old names for
303certain C0 and C1 controls
304.PP
305.Vb 1
306\& old new
307.Ve
308.PP
309.Vb 8
310\& HORIZONTAL TABULATION CHARACTER TABULATION
311\& VERTICAL TABULATION LINE TABULATION
312\& FILE SEPARATOR INFORMATION SEPARATOR FOUR
313\& GROUP SEPARATOR INFORMATION SEPARATOR THREE
314\& RECORD SEPARATOR INFORMATION SEPARATOR TWO
315\& UNIT SEPARATOR INFORMATION SEPARATOR ONE
316\& PARTIAL LINE DOWN PARTIAL LINE FORWARD
317\& PARTIAL LINE UP PARTIAL LINE BACKWARD
318.Ve
319.PP
320but the old names in addition to giving the character
321will also give a warning about being deprecated.
322.SH "ILLEGAL CHARACTERS"
323.IX Header "ILLEGAL CHARACTERS"
324If you ask by name for a character that does not exist, a warning is
325given and the Unicode \fIreplacement character\fR \*(L"\ex{\s-1FFFD\s0}\*(R" is returned.
326.PP
327If you ask by code for a character that does not exist, no warning is
328given and \f(CW\*(C`undef\*(C'\fR is returned. (Though if you ask for a code point
329past U+10FFFF you do get a warning.)
330.SH "BUGS"
331.IX Header "BUGS"
332Since evaluation of the translation function happens in a middle of
333compilation (of a string literal), the translation function should not
334do any \f(CW\*(C`eval\*(C'\fRs or \f(CW\*(C`require\*(C'\fRs. This restriction should be lifted in
335a future version of Perl.