1/*
2 **********************************************************************
3 *   Copyright (C) 1997-2009, International Business Machines
4 *   Corporation and others.  All Rights Reserved.
5 **********************************************************************
6 *
7 * File USCRIPT.H
8 *
9 * Modification History:
10 *
11 *   Date        Name        Description
12 *   07/06/2001    Ram         Creation.
13 ******************************************************************************
14 */
15
16#ifndef USCRIPT_H
17#define USCRIPT_H
18#include "unicode/utypes.h"
19
20/**
21 * \file
22 * \brief C API: Unicode Script Information
23 */
24
25/**
26 * Constants for ISO 15924 script codes.
27 *
28 * Many of these script codes - those from Unicode's ScriptNames.txt -
29 * are character property values for Unicode's Script property.
30 * See UAX #24 Script Names (http://www.unicode.org/reports/tr24/).
31 *
32 * Starting with ICU 3.6, constants for most ISO 15924 script codes
33 * are included (currently excluding private-use codes Qaaa..Qabx).
34 * For scripts for which there are codes in ISO 15924 but which are not
35 * used in the Unicode Character Database (UCD), there are no Unicode characters
36 * associated with those scripts.
37 *
38 * For example, there are no characters that have a UCD script code of
39 * Hans or Hant. All Han ideographs have the Hani script code.
40 * The Hans and Hant script codes are used with CLDR data.
41 *
42 * ISO 15924 script codes are included for use with CLDR and similar.
43 *
44 * @stable ICU 2.2
45 */
46typedef enum UScriptCode {
47      USCRIPT_INVALID_CODE = -1,
48      USCRIPT_COMMON       =  0 , /* Zyyy */
49      USCRIPT_INHERITED    =  1,  /* Qaai */
50      USCRIPT_ARABIC       =  2,  /* Arab */
51      USCRIPT_ARMENIAN     =  3,  /* Armn */
52      USCRIPT_BENGALI      =  4,  /* Beng */
53      USCRIPT_BOPOMOFO     =  5,  /* Bopo */
54      USCRIPT_CHEROKEE     =  6,  /* Cher */
55      USCRIPT_COPTIC       =  7,  /* Copt */
56      USCRIPT_CYRILLIC     =  8,  /* Cyrl */
57      USCRIPT_DESERET      =  9,  /* Dsrt */
58      USCRIPT_DEVANAGARI   = 10,  /* Deva */
59      USCRIPT_ETHIOPIC     = 11,  /* Ethi */
60      USCRIPT_GEORGIAN     = 12,  /* Geor */
61      USCRIPT_GOTHIC       = 13,  /* Goth */
62      USCRIPT_GREEK        = 14,  /* Grek */
63      USCRIPT_GUJARATI     = 15,  /* Gujr */
64      USCRIPT_GURMUKHI     = 16,  /* Guru */
65      USCRIPT_HAN          = 17,  /* Hani */
66      USCRIPT_HANGUL       = 18,  /* Hang */
67      USCRIPT_HEBREW       = 19,  /* Hebr */
68      USCRIPT_HIRAGANA     = 20,  /* Hira */
69      USCRIPT_KANNADA      = 21,  /* Knda */
70      USCRIPT_KATAKANA     = 22,  /* Kana */
71      USCRIPT_KHMER        = 23,  /* Khmr */
72      USCRIPT_LAO          = 24,  /* Laoo */
73      USCRIPT_LATIN        = 25,  /* Latn */
74      USCRIPT_MALAYALAM    = 26,  /* Mlym */
75      USCRIPT_MONGOLIAN    = 27,  /* Mong */
76      USCRIPT_MYANMAR      = 28,  /* Mymr */
77      USCRIPT_OGHAM        = 29,  /* Ogam */
78      USCRIPT_OLD_ITALIC   = 30,  /* Ital */
79      USCRIPT_ORIYA        = 31,  /* Orya */
80      USCRIPT_RUNIC        = 32,  /* Runr */
81      USCRIPT_SINHALA      = 33,  /* Sinh */
82      USCRIPT_SYRIAC       = 34,  /* Syrc */
83      USCRIPT_TAMIL        = 35,  /* Taml */
84      USCRIPT_TELUGU       = 36,  /* Telu */
85      USCRIPT_THAANA       = 37,  /* Thaa */
86      USCRIPT_THAI         = 38,  /* Thai */
87      USCRIPT_TIBETAN      = 39,  /* Tibt */
88      /** Canadian_Aboriginal script. @stable ICU 2.6 */
89      USCRIPT_CANADIAN_ABORIGINAL = 40,  /* Cans */
90      /** Canadian_Aboriginal script (alias). @stable ICU 2.2 */
91      USCRIPT_UCAS         = USCRIPT_CANADIAN_ABORIGINAL,
92      USCRIPT_YI           = 41,  /* Yiii */
93      USCRIPT_TAGALOG      = 42,  /* Tglg */
94      USCRIPT_HANUNOO      = 43,  /* Hano */
95      USCRIPT_BUHID        = 44,  /* Buhd */
96      USCRIPT_TAGBANWA     = 45,  /* Tagb */
97
98      /* New scripts in Unicode 4 @stable ICU 2.6 */
99      USCRIPT_BRAILLE      = 46,  /* Brai */
100      USCRIPT_CYPRIOT      = 47,  /* Cprt */
101      USCRIPT_LIMBU        = 48,  /* Limb */
102      USCRIPT_LINEAR_B     = 49,  /* Linb */
103      USCRIPT_OSMANYA      = 50,  /* Osma */
104      USCRIPT_SHAVIAN      = 51,  /* Shaw */
105      USCRIPT_TAI_LE       = 52,  /* Tale */
106      USCRIPT_UGARITIC     = 53,  /* Ugar */
107
108      /** New script code in Unicode 4.0.1 @stable ICU 3.0 */
109      USCRIPT_KATAKANA_OR_HIRAGANA = 54,/*Hrkt */
110
111      /* New scripts in Unicode 4.1 @stable ICU 3.4 */
112      USCRIPT_BUGINESE      = 55, /* Bugi */
113      USCRIPT_GLAGOLITIC    = 56, /* Glag */
114      USCRIPT_KHAROSHTHI    = 57, /* Khar */
115      USCRIPT_SYLOTI_NAGRI  = 58, /* Sylo */
116      USCRIPT_NEW_TAI_LUE   = 59, /* Talu */
117      USCRIPT_TIFINAGH      = 60, /* Tfng */
118      USCRIPT_OLD_PERSIAN   = 61, /* Xpeo */
119
120      /* New script codes from ISO 15924 @stable ICU 3.6 */
121      USCRIPT_BALINESE                      = 62, /* Bali */
122      USCRIPT_BATAK                         = 63, /* Batk */
123      USCRIPT_BLISSYMBOLS                   = 64, /* Blis */
124      USCRIPT_BRAHMI                        = 65, /* Brah */
125      USCRIPT_CHAM                          = 66, /* Cham */
126      USCRIPT_CIRTH                         = 67, /* Cirt */
127      USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC  = 68, /* Cyrs */
128      USCRIPT_DEMOTIC_EGYPTIAN              = 69, /* Egyd */
129      USCRIPT_HIERATIC_EGYPTIAN             = 70, /* Egyh */
130      USCRIPT_EGYPTIAN_HIEROGLYPHS          = 71, /* Egyp */
131      USCRIPT_KHUTSURI                      = 72, /* Geok */
132      USCRIPT_SIMPLIFIED_HAN                = 73, /* Hans */
133      USCRIPT_TRADITIONAL_HAN               = 74, /* Hant */
134      USCRIPT_PAHAWH_HMONG                  = 75, /* Hmng */
135      USCRIPT_OLD_HUNGARIAN                 = 76, /* Hung */
136      USCRIPT_HARAPPAN_INDUS                = 77, /* Inds */
137      USCRIPT_JAVANESE                      = 78, /* Java */
138      USCRIPT_KAYAH_LI                      = 79, /* Kali */
139      USCRIPT_LATIN_FRAKTUR                 = 80, /* Latf */
140      USCRIPT_LATIN_GAELIC                  = 81, /* Latg */
141      USCRIPT_LEPCHA                        = 82, /* Lepc */
142      USCRIPT_LINEAR_A                      = 83, /* Lina */
143      USCRIPT_MANDAEAN                      = 84, /* Mand */
144      USCRIPT_MAYAN_HIEROGLYPHS             = 85, /* Maya */
145      USCRIPT_MEROITIC                      = 86, /* Mero */
146      USCRIPT_NKO                           = 87, /* Nkoo */
147      USCRIPT_ORKHON                        = 88, /* Orkh */
148      USCRIPT_OLD_PERMIC                    = 89, /* Perm */
149      USCRIPT_PHAGS_PA                      = 90, /* Phag */
150      USCRIPT_PHOENICIAN                    = 91, /* Phnx */
151      USCRIPT_PHONETIC_POLLARD              = 92, /* Plrd */
152      USCRIPT_RONGORONGO                    = 93, /* Roro */
153      USCRIPT_SARATI                        = 94, /* Sara */
154      USCRIPT_ESTRANGELO_SYRIAC             = 95, /* Syre */
155      USCRIPT_WESTERN_SYRIAC                = 96, /* Syrj */
156      USCRIPT_EASTERN_SYRIAC                = 97, /* Syrn */
157      USCRIPT_TENGWAR                       = 98, /* Teng */
158      USCRIPT_VAI                           = 99, /* Vaii */
159      USCRIPT_VISIBLE_SPEECH                = 100, /* Visp */
160      USCRIPT_CUNEIFORM                     = 101,/* Xsux */
161      USCRIPT_UNWRITTEN_LANGUAGES           = 102,/* Zxxx */
162      USCRIPT_UNKNOWN                       = 103,/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */
163
164      /* New script codes from ISO 15924 @stable ICU 3.8 */
165      USCRIPT_CARIAN                        = 104,/* Cari */
166      USCRIPT_JAPANESE                      = 105,/* Jpan */
167      USCRIPT_LANNA                         = 106,/* Lana */
168      USCRIPT_LYCIAN                        = 107,/* Lyci */
169      USCRIPT_LYDIAN                        = 108,/* Lydi */
170      USCRIPT_OL_CHIKI                      = 109,/* Olck */
171      USCRIPT_REJANG                        = 110,/* Rjng */
172      USCRIPT_SAURASHTRA                    = 111,/* Saur */
173      USCRIPT_SIGN_WRITING                  = 112,/* Sgnw */
174      USCRIPT_SUNDANESE                     = 113,/* Sund */
175      USCRIPT_MOON                          = 114,/* Moon */
176      USCRIPT_MEITEI_MAYEK                  = 115,/* Mtei */
177
178      /* New script codes from ISO 15924 @stable ICU 4.0 */
179      USCRIPT_IMPERIAL_ARAMAIC              = 116,/* Armi */
180      USCRIPT_AVESTAN                       = 117,/* Avst */
181      USCRIPT_CHAKMA                        = 118,/* Cakm */
182      USCRIPT_KOREAN                        = 119,/* Kore */
183      USCRIPT_KAITHI                        = 120,/* Kthi */
184      USCRIPT_MANICHAEAN                    = 121,/* Mani */
185      USCRIPT_INSCRIPTIONAL_PAHLAVI         = 122,/* Phli */
186      USCRIPT_PSALTER_PAHLAVI               = 123,/* Phlp */
187      USCRIPT_BOOK_PAHLAVI                  = 124,/* Phlv */
188      USCRIPT_INSCRIPTIONAL_PARTHIAN        = 125,/* Prti */
189      USCRIPT_SAMARITAN                     = 126,/* Samr */
190      USCRIPT_TAI_VIET                      = 127,/* Tavt */
191      USCRIPT_MATHEMATICAL_NOTATION         = 128,/* Zmth */
192      USCRIPT_SYMBOLS                       = 129,/* Zsym */
193
194      /* Private use codes from Qaaa - Qabx are not supported*/
195      USCRIPT_CODE_LIMIT    = 130
196} UScriptCode;
197
198/**
199 * Gets script codes associated with the given locale or ISO 15924 abbreviation or name.
200 * Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym".
201 * Fills in USCRIPT_LATIN given "en" OR "en_US"
202 * If required capacity is greater than capacity of the destination buffer then the error code
203 * is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned
204 *
205 * <p>Note: To search by short or long script alias only, use
206 * u_getPropertyValueEnum(UCHAR_SCRIPT, alias) instead.  This does
207 * a fast lookup with no access of the locale data.
208 * @param nameOrAbbrOrLocale name of the script, as given in
209 * PropertyValueAliases.txt, or ISO 15924 code or locale
210 * @param fillIn the UScriptCode buffer to fill in the script code
211 * @param capacity the capacity (size) fo UScriptCode buffer passed in.
212 * @param err the error status code.
213 * @return The number of script codes filled in the buffer passed in
214 * @stable ICU 2.4
215 */
216U_STABLE int32_t  U_EXPORT2
217uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err);
218
219/**
220 * Gets a script name associated with the given script code.
221 * Returns  "Malayam" given USCRIPT_MALAYALAM
222 * @param scriptCode UScriptCode enum
223 * @return script long name as given in
224 * PropertyValueAliases.txt, or NULL if scriptCode is invalid
225 * @stable ICU 2.4
226 */
227U_STABLE const char*  U_EXPORT2
228uscript_getName(UScriptCode scriptCode);
229
230/**
231 * Gets a script name associated with the given script code.
232 * Returns  "Mlym" given USCRIPT_MALAYALAM
233 * @param scriptCode UScriptCode enum
234 * @return script abbreviated name as given in
235 * PropertyValueAliases.txt, or NULL if scriptCode is invalid
236 * @stable ICU 2.4
237 */
238U_STABLE const char*  U_EXPORT2
239uscript_getShortName(UScriptCode scriptCode);
240
241/**
242 * Gets the script code associated with the given codepoint.
243 * Returns USCRIPT_MALAYALAM given 0x0D02
244 * @param codepoint UChar32 codepoint
245 * @param err the error status code.
246 * @return The UScriptCode, or 0 if codepoint is invalid
247 * @stable ICU 2.4
248 */
249U_STABLE UScriptCode  U_EXPORT2
250uscript_getScript(UChar32 codepoint, UErrorCode *err);
251
252#endif
253
254
255