1/*
2**********************************************************************
3*   Copyright (C) 1997-2004, 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#ifndef USCRIPT_H
16#define USCRIPT_H
17#include "unicode/utypes.h"
18
19/**
20 * Constants for Unicode script values from ScriptNames.txt .
21 *
22 * @stable ICU 2.2
23 */
24typedef enum UScriptCode {
25      USCRIPT_INVALID_CODE = -1,
26      USCRIPT_COMMON       =  0 , /* Zyyy */
27      USCRIPT_INHERITED    =  1,  /* Qaai */
28      USCRIPT_ARABIC       =  2,  /* Arab */
29      USCRIPT_ARMENIAN     =  3,  /* Armn */
30      USCRIPT_BENGALI      =  4,  /* Beng */
31      USCRIPT_BOPOMOFO     =  5,  /* Bopo */
32      USCRIPT_CHEROKEE     =  6,  /* Cher */
33      USCRIPT_COPTIC       =  7,  /* Copt */
34      USCRIPT_CYRILLIC     =  8,  /* Cyrl (Cyrs) */
35      USCRIPT_DESERET      =  9,  /* Dsrt */
36      USCRIPT_DEVANAGARI   = 10,  /* Deva */
37      USCRIPT_ETHIOPIC     = 11,  /* Ethi */
38      USCRIPT_GEORGIAN     = 12,  /* Geor (Geon, Geoa) */
39      USCRIPT_GOTHIC       = 13,  /* Goth */
40      USCRIPT_GREEK        = 14,  /* Grek */
41      USCRIPT_GUJARATI     = 15,  /* Gujr */
42      USCRIPT_GURMUKHI     = 16,  /* Guru */
43      USCRIPT_HAN          = 17,  /* Hani */
44      USCRIPT_HANGUL       = 18,  /* Hang */
45      USCRIPT_HEBREW       = 19,  /* Hebr */
46      USCRIPT_HIRAGANA     = 20,  /* Hira */
47      USCRIPT_KANNADA      = 21,  /* Knda */
48      USCRIPT_KATAKANA     = 22,  /* Kana */
49      USCRIPT_KHMER        = 23,  /* Khmr */
50      USCRIPT_LAO          = 24,  /* Laoo */
51      USCRIPT_LATIN        = 25,  /* Latn (Latf, Latg) */
52      USCRIPT_MALAYALAM    = 26,  /* Mlym */
53      USCRIPT_MONGOLIAN    = 27,  /* Mong */
54      USCRIPT_MYANMAR      = 28,  /* Mymr */
55      USCRIPT_OGHAM        = 29,  /* Ogam */
56      USCRIPT_OLD_ITALIC   = 30,  /* Ital */
57      USCRIPT_ORIYA        = 31,  /* Orya */
58      USCRIPT_RUNIC        = 32,  /* Runr */
59      USCRIPT_SINHALA      = 33,  /* Sinh */
60      USCRIPT_SYRIAC       = 34,  /* Syrc (Syrj, Syrn, Syre) */
61      USCRIPT_TAMIL        = 35,  /* Taml */
62      USCRIPT_TELUGU       = 36,  /* Telu */
63      USCRIPT_THAANA       = 37,  /* Thaa */
64      USCRIPT_THAI         = 38,  /* Thai */
65      USCRIPT_TIBETAN      = 39,  /* Tibt */
66      /** Canadian_Aboriginal script. @stable ICU 2.6 */
67      USCRIPT_CANADIAN_ABORIGINAL = 40,  /* Cans */
68      /** Canadian_Aboriginal script (alias). @stable ICU 2.2 */
69      USCRIPT_UCAS         = USCRIPT_CANADIAN_ABORIGINAL,
70      USCRIPT_YI           = 41,  /* Yiii */
71      USCRIPT_TAGALOG      = 42,  /* Tglg */
72      USCRIPT_HANUNOO      = 43,  /* Hano */
73      USCRIPT_BUHID        = 44,  /* Buhd */
74      USCRIPT_TAGBANWA     = 45,  /* Tagb */
75
76      /* New scripts in Unicode 4 @stable ICU 2.6 */
77      USCRIPT_BRAILLE,            /* Brai */
78      USCRIPT_CYPRIOT,            /* Cprt */
79      USCRIPT_LIMBU,              /* Limb */
80      USCRIPT_LINEAR_B,           /* Linb */
81      USCRIPT_OSMANYA,            /* Osma */
82      USCRIPT_SHAVIAN,            /* Shaw */
83      USCRIPT_TAI_LE,             /* Tale */
84      USCRIPT_UGARITIC,           /* Ugar */
85
86      /** New script code in Unicode 4.0.1 @draft ICU 3.0 */
87      USCRIPT_KATAKANA_OR_HIRAGANA,/*Hrkt */
88
89      USCRIPT_CODE_LIMIT
90} UScriptCode;
91
92/**
93 * Gets script codes associated with the given locale or ISO 15924 abbreviation or name.
94 * Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym".
95 * Fills in USCRIPT_LATIN given "en" OR "en_US"
96 * If required capacity is greater than capacity of the destination buffer then the error code
97 * is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned
98 *
99 * <p>Note: To search by short or long script alias only, use
100 * u_getPropertyValueEnum(UCHAR_SCRIPT, alias) instead.  This does
101 * a fast lookup with no access of the locale data.
102 * @param nameOrAbbrOrLocale name of the script, as given in
103 * PropertyValueAliases.txt, or ISO 15924 code or locale
104 * @param fillIn the UScriptCode buffer to fill in the script code
105 * @param capacity the capacity (size) fo UScriptCode buffer passed in.
106 * @param err the error status code.
107 * @return The number of script codes filled in the buffer passed in
108 * @stable ICU 2.4
109 */
110U_STABLE int32_t  U_EXPORT2
111uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err);
112
113/**
114 * Gets a script name associated with the given script code.
115 * Returns  "Malayam" given USCRIPT_MALAYALAM
116 * @param scriptCode UScriptCode enum
117 * @return script long name as given in
118 * PropertyValueAliases.txt, or NULL if scriptCode is invalid
119 * @stable ICU 2.4
120 */
121U_STABLE const char*  U_EXPORT2
122uscript_getName(UScriptCode scriptCode);
123
124/**
125 * Gets a script name associated with the given script code.
126 * Returns  "Mlym" given USCRIPT_MALAYALAM
127 * @param scriptCode UScriptCode enum
128 * @return script abbreviated name as given in
129 * PropertyValueAliases.txt, or NULL if scriptCode is invalid
130 * @stable ICU 2.4
131 */
132U_STABLE const char*  U_EXPORT2
133uscript_getShortName(UScriptCode scriptCode);
134
135/**
136 * Gets the script code associated with the given codepoint.
137 * Returns USCRIPT_MALAYALAM given 0x0D02
138 * @param codepoint UChar32 codepoint
139 * @param err the error status code.
140 * @return The UScriptCode, or 0 if codepoint is invalid
141 * @stable ICU 2.4
142 */
143U_STABLE UScriptCode  U_EXPORT2
144uscript_getScript(UChar32 codepoint, UErrorCode *err);
145
146#endif
147
148
149