Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / man / man3 / Locale::Script.3
CommitLineData
920dae64
AT
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
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 "Locale::Script 3"
132.TH Locale::Script 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide"
133.SH "NAME"
134Locale::Script \- ISO codes for script identification (ISO 15924)
135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS"
137.Vb 2
138\& use Locale::Script;
139\& use Locale::Constants;
140.Ve
141.PP
142.Vb 6
143\& $script = code2script('ph'); # 'Phoenician'
144\& $code = script2code('Tibetan'); # 'bo'
145\& $code3 = script2code('Tibetan',
146\& LOCALE_CODE_ALPHA_3); # 'bod'
147\& $codeN = script2code('Tibetan',
148\& LOCALE_CODE_ALPHA_NUMERIC); # 330
149.Ve
150.PP
151.Vb 2
152\& @codes = all_script_codes();
153\& @scripts = all_script_names();
154.Ve
155.SH "DESCRIPTION"
156.IX Header "DESCRIPTION"
157The \f(CW\*(C`Locale::Script\*(C'\fR module provides access to the \s-1ISO\s0
158codes for identifying scripts, as defined in \s-1ISO\s0 15924.
159For example, Egyptian hieroglyphs are denoted by the two-letter
160code 'eg', the three-letter code 'egy', and the numeric code 050.
161.PP
162You can either access the codes via the conversion routines
163(described below), or with the two functions which return lists
164of all script codes or all script names.
165.PP
166There are three different code sets you can use for identifying
167scripts:
168.IP "\fBalpha\-2\fR" 4
169.IX Item "alpha-2"
170Two letter codes, such as 'bo' for Tibetan.
171This code set is identified with the symbol \f(CW\*(C`LOCALE_CODE_ALPHA_2\*(C'\fR.
172.IP "\fBalpha\-3\fR" 4
173.IX Item "alpha-3"
174Three letter codes, such as 'ell' for Greek.
175This code set is identified with the symbol \f(CW\*(C`LOCALE_CODE_ALPHA_3\*(C'\fR.
176.IP "\fBnumeric\fR" 4
177.IX Item "numeric"
178Numeric codes, such as 410 for Hiragana.
179This code set is identified with the symbol \f(CW\*(C`LOCALE_CODE_NUMERIC\*(C'\fR.
180.PP
181All of the routines take an optional additional argument
182which specifies the code set to use.
183If not specified, it defaults to the two-letter codes.
184This is partly for backwards compatibility (previous versions
185of Locale modules only supported the alpha\-2 codes), and
186partly because they are the most widely used codes.
187.PP
188The alpha\-2 and alpha\-3 codes are not case\-dependent,
189so you can use '\s-1BO\s0', 'Bo', 'bO' or 'bo' for Tibetan.
190When a code is returned by one of the functions in
191this module, it will always be lower\-case.
192.Sh "\s-1SPECIAL\s0 \s-1CODES\s0"
193.IX Subsection "SPECIAL CODES"
194The standard defines various special codes.
195.IP "\(bu" 4
196The standard reserves codes in the ranges \fBqa\fR \- \fBqt\fR,
197\&\fBqaa\fR \- \fBqat\fR, and \fB900\fR \- \fB919\fR, for private use.
198.IP "\(bu" 4
199\&\fBzx\fR, \fBzxx\fR, and \fB997\fR, are the codes for unwritten languages.
200.IP "\(bu" 4
201\&\fBzy\fR, \fBzyy\fR, and \fB998\fR, are the codes for an undetermined script.
202.IP "\(bu" 4
203\&\fBzz\fR, \fBzzz\fR, and \fB999\fR, are the codes for an uncoded script.
204.PP
205The private codes are not recognised by Locale::Script,
206but the others are.
207.SH "CONVERSION ROUTINES"
208.IX Header "CONVERSION ROUTINES"
209There are three conversion routines: \f(CW\*(C`code2script()\*(C'\fR, \f(CW\*(C`script2code()\*(C'\fR,
210and \f(CW\*(C`script_code2code()\*(C'\fR.
211.IP "code2script( \s-1CODE\s0, [ \s-1CODESET\s0 ] )" 4
212.IX Item "code2script( CODE, [ CODESET ] )"
213This function takes a script code and returns a string
214which contains the name of the script identified.
215If the code is not a valid script code, as defined by \s-1ISO\s0 15924,
216then \f(CW\*(C`undef\*(C'\fR will be returned:
217.Sp
218.Vb 1
219\& $script = code2script('cy'); # Cyrillic
220.Ve
221.IP "script2code( \s-1STRING\s0, [ \s-1CODESET\s0 ] )" 4
222.IX Item "script2code( STRING, [ CODESET ] )"
223This function takes a script name and returns the corresponding
224script code, if such exists.
225If the argument could not be identified as a script name,
226then \f(CW\*(C`undef\*(C'\fR will be returned:
227.Sp
228.Vb 2
229\& $code = script2code('Gothic', LOCALE_CODE_ALPHA_3);
230\& # $code will now be 'gth'
231.Ve
232.Sp
233The case of the script name is not important.
234See the section \*(L"\s-1KNOWN\s0 \s-1BUGS\s0 \s-1AND\s0 \s-1LIMITATIONS\s0\*(R" below.
235.IP "script_code2code( \s-1CODE\s0, \s-1CODESET\s0, \s-1CODESET\s0 )" 4
236.IX Item "script_code2code( CODE, CODESET, CODESET )"
237This function takes a script code from one code set,
238and returns the corresponding code from another code set.
239.Sp
240.Vb 3
241\& $alpha2 = script_code2code('jwi',
242\& LOCALE_CODE_ALPHA_3 => LOCALE_CODE_ALPHA_2);
243\& # $alpha2 will now be 'jw' (Javanese)
244.Ve
245.Sp
246If the code passed is not a valid script code in
247the first code set, or if there isn't a code for the
248corresponding script in the second code set,
249then \f(CW\*(C`undef\*(C'\fR will be returned.
250.SH "QUERY ROUTINES"
251.IX Header "QUERY ROUTINES"
252There are two function which can be used to obtain a list of all codes,
253or all script names:
254.ie n .IP """all_script_codes ( [ CODESET ] )""" 4
255.el .IP "\f(CWall_script_codes ( [ CODESET ] )\fR" 4
256.IX Item "all_script_codes ( [ CODESET ] )"
257Returns a list of all two-letter script codes.
258The codes are guaranteed to be all lower\-case,
259and not in any particular order.
260.ie n .IP """all_script_names ( [ CODESET ] )""" 4
261.el .IP "\f(CWall_script_names ( [ CODESET ] )\fR" 4
262.IX Item "all_script_names ( [ CODESET ] )"
263Returns a list of all script names for which there is a corresponding
264script code in the specified code set.
265The names are capitalised, and not returned in any particular order.
266.SH "EXAMPLES"
267.IX Header "EXAMPLES"
268The following example illustrates use of the \f(CW\*(C`code2script()\*(C'\fR function.
269The user is prompted for a script code, and then told the corresponding
270script name:
271.PP
272.Vb 1
273\& $| = 1; # turn off buffering
274.Ve
275.PP
276.Vb 11
277\& print "Enter script code: ";
278\& chop($code = <STDIN>);
279\& $script = code2script($code, LOCALE_CODE_ALPHA_2);
280\& if (defined $script)
281\& {
282\& print "$code = $script\en";
283\& }
284\& else
285\& {
286\& print "'$code' is not a valid script code!\en";
287\& }
288.Ve
289.SH "KNOWN BUGS AND LIMITATIONS"
290.IX Header "KNOWN BUGS AND LIMITATIONS"
291.IP "\(bu" 4
292When using \f(CW\*(C`script2code()\*(C'\fR, the script name must currently appear
293exactly as it does in the source of the module. For example,
294.Sp
295.Vb 1
296\& script2code('Egyptian hieroglyphs')
297.Ve
298.Sp
299will return \fBeg\fR, as expected. But the following will all return \f(CW\*(C`undef\*(C'\fR:
300.Sp
301.Vb 2
302\& script2code('hieroglyphs')
303\& script2code('Egyptian Hieroglypics')
304.Ve
305.Sp
306If there's need for it, a future version could have variants
307for script names.
308.IP "\(bu" 4
309In the current implementation, all data is read in when the
310module is loaded, and then held in memory.
311A lazy implementation would be more memory friendly.
312.SH "SEE ALSO"
313.IX Header "SEE ALSO"
314.IP "Locale::Language" 4
315.IX Item "Locale::Language"
316\&\s-1ISO\s0 two letter codes for identification of language (\s-1ISO\s0 639).
317.IP "Locale::Currency" 4
318.IX Item "Locale::Currency"
319\&\s-1ISO\s0 three letter codes for identification of currencies
320and funds (\s-1ISO\s0 4217).
321.IP "Locale::Country" 4
322.IX Item "Locale::Country"
323\&\s-1ISO\s0 three letter codes for identification of countries (\s-1ISO\s0 3166)
324.IP "\s-1ISO\s0 15924" 4
325.IX Item "ISO 15924"
326The \s-1ISO\s0 standard which defines these codes.
327.IP "http://www.evertype.com/standards/iso15924/" 4
328.IX Item "http://www.evertype.com/standards/iso15924/"
329Home page for \s-1ISO\s0 15924.
330.SH "AUTHOR"
331.IX Header "AUTHOR"
332Neil Bowers <neil@bowers.com>
333.SH "COPYRIGHT"
334.IX Header "COPYRIGHT"
335Copyright (c) 2002\-2004 Neil Bowers.
336.PP
337This module is free software; you can redistribute it and/or
338modify it under the same terms as Perl itself.