xref: /titanic_52/usr/src/uts/common/smbsrv/ntlocale.h (revision d92a527c473246e5c750ae6c33ecd2f242a5bf1f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SMBSRV_NTLOCALE_H
27 #define	_SMBSRV_NTLOCALE_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * NT language and locale identifiers.
33  */
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 
40 /*
41  * Language IDs.
42  *
43  * A language ID is a 16 bit value which is the combination of a
44  * primary language ID and a secondary language ID. The bits are
45  * allocated as follows:
46  *
47  *      +-----------------------+-------------------------+
48  *      |     Sublanguage ID    |   Primary Language ID   |
49  *      +-----------------------+-------------------------+
50  *       15                   10 9                       0   bit
51  *
52  * The following two combinations of primary language ID and sub-
53  * language ID have special semantics:
54  *
55  * Primary Language ID   Sublanguage ID      Result
56  * -------------------   ---------------     ------------------------
57  * LANG_NEUTRAL          SUBLANG_NEUTRAL     Language neutral
58  * LANG_NEUTRAL          SUBLANG_DEFAULT     User default language
59  * LANG_NEUTRAL          SUBLANG_SYS_DEFAULT System default language
60  *
61  * Language ID creation/extraction macros:
62  * MAKELANGID    - construct language id from a primary language
63  *                 id and a sublanguage id.
64  * PRIMARYLANGID - extract primary language id from a language id.
65  * SUBLANGID     - extract sublanguage id from a language id.
66  */
67 #define	MAKELANGID(p, s)	((((WORD)(s)) << 10) | (WORD)(p))
68 #define	PRIMARYLANGID(lgid)	((WORD)(lgid) & 0x3ff)
69 #define	SUBLANGID(lgid)		((WORD)(lgid) >> 10)
70 
71 
72 /*
73  * Primary language IDs.
74  */
75 #define	LANG_NEUTRAL			0x00
76 
77 #define	LANG_AFRIKAANS			0x36
78 #define	LANG_ALBANIAN			0x1c
79 #define	LANG_ARABIC			0x01
80 #define	LANG_ARMENIAN			0x2b
81 #define	LANG_ASSAMESE			0x4d
82 #define	LANG_AZERI			0x2c
83 #define	LANG_BASQUE			0x2d
84 #define	LANG_BELARUSIAN			0x23
85 #define	LANG_BENGALI			0x45
86 #define	LANG_BULGARIAN			0x02
87 #define	LANG_CATALAN			0x03
88 #define	LANG_CHINESE			0x04
89 #define	LANG_CROATIAN			0x1a
90 #define	LANG_CZECH			0x05
91 #define	LANG_DANISH			0x06
92 #define	LANG_DUTCH			0x13
93 #define	LANG_ENGLISH			0x09
94 #define	LANG_ESTONIAN			0x25
95 #define	LANG_FAEROESE			0x38
96 #define	LANG_FARSI			0x29
97 #define	LANG_FINNISH			0x0b
98 #define	LANG_FRENCH			0x0c
99 #define	LANG_GEORGIAN			0x37
100 #define	LANG_GERMAN			0x07
101 #define	LANG_GREEK			0x08
102 #define	LANG_GUJARATI			0x47
103 #define	LANG_HEBREW			0x0d
104 #define	LANG_HINDI			0x39
105 #define	LANG_HUNGARIAN			0x0e
106 #define	LANG_ICELANDIC			0x0f
107 #define	LANG_INDONESIAN			0x21
108 #define	LANG_ITALIAN			0x10
109 #define	LANG_JAPANESE			0x11
110 #define	LANG_KANNADA			0x4b
111 #define	LANG_KASHMIRI			0x60
112 #define	LANG_KAZAK			0x3f
113 #define	LANG_KONKANI			0x57
114 #define	LANG_KOREAN			0x12
115 #define	LANG_LATVIAN			0x26
116 #define	LANG_LITHUANIAN			0x27
117 #define	LANG_MACEDONIAN			0x2f
118 #define	LANG_MALAY			0x3e
119 #define	LANG_MALAYALAM			0x4c
120 #define	LANG_MANIPURI			0x58
121 #define	LANG_MARATHI			0x4e
122 #define	LANG_NEPALI			0x61
123 #define	LANG_NORWEGIAN			0x14
124 #define	LANG_ORIYA			0x48
125 #define	LANG_POLISH			0x15
126 #define	LANG_PORTUGUESE			0x16
127 #define	LANG_PUNJABI			0x46
128 #define	LANG_ROMANIAN			0x18
129 #define	LANG_RUSSIAN			0x19
130 #define	LANG_SANSKRIT			0x4f
131 #define	LANG_SERBIAN			0x1a
132 #define	LANG_SINDHI			0x59
133 #define	LANG_SLOVAK			0x1b
134 #define	LANG_SLOVENIAN			0x24
135 #define	LANG_SPANISH			0x0a
136 #define	LANG_SWAHILI			0x41
137 #define	LANG_SWEDISH			0x1d
138 #define	LANG_TAMIL			0x49
139 #define	LANG_TATAR			0x44
140 #define	LANG_TELUGU			0x4a
141 #define	LANG_THAI			0x1e
142 #define	LANG_TURKISH			0x1f
143 #define	LANG_UKRAINIAN			0x22
144 #define	LANG_URDU			0x20
145 #define	LANG_UZBEK			0x43
146 #define	LANG_VIETNAMESE			0x2a
147 
148 
149 /*
150  * Sublanguage IDs.
151  *
152  * The name immediately following SUBLANG_ dictates which primary
153  * language ID can be combined with the sub-language ID to form a
154  * valid language ID.
155  */
156 #define	SUBLANG_NEUTRAL			0x00	/* language neutral */
157 #define	SUBLANG_DEFAULT			0x01	/* user default */
158 #define	SUBLANG_SYS_DEFAULT		0x02	/* system default */
159 
160 #define	SUBLANG_ARABIC_SAUDI_ARABIA	0x01	/* Arabic (Saudi Arabia) */
161 #define	SUBLANG_ARABIC_IRAQ		0x02	/* Arabic (Iraq) */
162 #define	SUBLANG_ARABIC_EGYPT		0x03	/* Arabic (Egypt) */
163 #define	SUBLANG_ARABIC_LIBYA		0x04	/* Arabic (Libya) */
164 #define	SUBLANG_ARABIC_ALGERIA		0x05	/* Arabic (Algeria) */
165 #define	SUBLANG_ARABIC_MOROCCO		0x06	/* Arabic (Morocco) */
166 #define	SUBLANG_ARABIC_TUNISIA		0x07	/* Arabic (Tunisia) */
167 #define	SUBLANG_ARABIC_OMAN		0x08	/* Arabic (Oman) */
168 #define	SUBLANG_ARABIC_YEMEN		0x09	/* Arabic (Yemen) */
169 #define	SUBLANG_ARABIC_SYRIA		0x0a	/* Arabic (Syria) */
170 #define	SUBLANG_ARABIC_JORDAN		0x0b	/* Arabic (Jordan) */
171 #define	SUBLANG_ARABIC_LEBANON		0x0c	/* Arabic (Lebanon) */
172 #define	SUBLANG_ARABIC_KUWAIT		0x0d	/* Arabic (Kuwait) */
173 #define	SUBLANG_ARABIC_UAE		0x0e	/* Arabic (U.A.E) */
174 #define	SUBLANG_ARABIC_BAHRAIN		0x0f	/* Arabic (Bahrain) */
175 #define	SUBLANG_ARABIC_QATAR		0x10	/* Arabic (Qatar) */
176 #define	SUBLANG_AZERI_LATIN		0x01	/* Azeri (Latin) */
177 #define	SUBLANG_AZERI_CYRILLIC		0x02	/* Azeri (Cyrillic) */
178 #define	SUBLANG_CHINESE_TRADITIONAL	0x01	/* Chinese (Taiwan Region) */
179 #define	SUBLANG_CHINESE_SIMPLIFIED	0x02	/* Chinese (PR China) */
180 #define	SUBLANG_CHINESE_HONGKONG	0x03	/* Chinese (Hong Kong) */
181 #define	SUBLANG_CHINESE_SINGAPORE	0x04	/* Chinese (Singapore) */
182 #define	SUBLANG_CHINESE_MACAU		0x05	/* Chinese (Macau) */
183 #define	SUBLANG_DUTCH			0x01	/* Dutch */
184 #define	SUBLANG_DUTCH_BELGIAN		0x02	/* Dutch (Belgian) */
185 #define	SUBLANG_ENGLISH_US		0x01	/* English (USA) */
186 #define	SUBLANG_ENGLISH_UK		0x02	/* English (UK) */
187 #define	SUBLANG_ENGLISH_AUS		0x03	/* English (Australian) */
188 #define	SUBLANG_ENGLISH_CAN		0x04	/* English (Canadian) */
189 #define	SUBLANG_ENGLISH_NZ		0x05	/* English (New Zealand) */
190 #define	SUBLANG_ENGLISH_EIRE		0x06	/* English (Irish) */
191 #define	SUBLANG_ENGLISH_SOUTH_AFRICA	0x07	/* English (South Africa) */
192 #define	SUBLANG_ENGLISH_JAMAICA		0x08	/* English (Jamaica) */
193 #define	SUBLANG_ENGLISH_CARIBBEAN	0x09	/* English (Caribbean) */
194 #define	SUBLANG_ENGLISH_BELIZE		0x0a	/* English (Belize) */
195 #define	SUBLANG_ENGLISH_TRINIDAD	0x0b	/* English (Trinidad) */
196 #define	SUBLANG_ENGLISH_ZIMBABWE	0x0c	/* English (Zimbabwe) */
197 #define	SUBLANG_ENGLISH_PHILIPPINES	0x0d	/* English (Philippines) */
198 #define	SUBLANG_FRENCH			0x01	/* French */
199 #define	SUBLANG_FRENCH_BELGIAN		0x02	/* French (Belgian) */
200 #define	SUBLANG_FRENCH_CANADIAN		0x03	/* French (Canadian) */
201 #define	SUBLANG_FRENCH_SWISS		0x04	/* French (Swiss) */
202 #define	SUBLANG_FRENCH_LUXEMBOURG	0x05	/* French (Luxembourg) */
203 #define	SUBLANG_FRENCH_MONACO		0x06	/* French (Monaco) */
204 #define	SUBLANG_GERMAN			0x01	/* German */
205 #define	SUBLANG_GERMAN_SWISS		0x02	/* German (Swiss) */
206 #define	SUBLANG_GERMAN_AUSTRIAN		0x03	/* German (Austrian) */
207 #define	SUBLANG_GERMAN_LUXEMBOURG	0x04	/* German (Luxembourg) */
208 #define	SUBLANG_GERMAN_LIECHTENSTEIN	0x05	/* German (Liechtenstein) */
209 #define	SUBLANG_ITALIAN			0x01	/* Italian */
210 #define	SUBLANG_ITALIAN_SWISS		0x02	/* Italian (Swiss) */
211 #define	SUBLANG_KASHMIRI_INDIA		0x02	/* Kashmiri (India) */
212 #define	SUBLANG_KOREAN			0x01	/* Korean (Extended Wansung) */
213 #define	SUBLANG_LITHUANIAN		0x01	/* Lithuanian */
214 #define	SUBLANG_LITHUANIAN_CLASSIC	0x02	/* Lithuanian (Classic) */
215 #define	SUBLANG_MALAY_MALAYSIA		0x01	/* Malay (Malaysia) */
216 #define	SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02	/* Malay (Brunei Darussalam) */
217 #define	SUBLANG_NEPALI_INDIA		0x02	/* Nepali (India) */
218 #define	SUBLANG_NORWEGIAN_BOKMAL	0x01	/* Norwegian (Bokmal) */
219 #define	SUBLANG_NORWEGIAN_NYNORSK	0x02	/* Norwegian (Nynorsk) */
220 #define	SUBLANG_PORTUGUESE		0x02	/* Portuguese */
221 #define	SUBLANG_PORTUGUESE_BRAZILIAN	0x01	/* Portuguese (Brazilian) */
222 #define	SUBLANG_SERBIAN_LATIN		0x02	/* Serbian (Latin) */
223 #define	SUBLANG_SERBIAN_CYRILLIC	0x03	/* Serbian (Cyrillic) */
224 #define	SUBLANG_SPANISH			0x01	/* Spanish (Castilian) */
225 #define	SUBLANG_SPANISH_MEXICAN		0x02	/* Spanish (Mexican) */
226 #define	SUBLANG_SPANISH_MODERN		0x03	/* Spanish (Modern) */
227 #define	SUBLANG_SPANISH_GUATEMALA	0x04	/* Spanish (Guatemala) */
228 #define	SUBLANG_SPANISH_COSTA_RICA	0x05	/* Spanish (Costa Rica) */
229 #define	SUBLANG_SPANISH_PANAMA		0x06	/* Spanish (Panama) */
230 #define	SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07	/* Spanish (Dom. Republic) */
231 #define	SUBLANG_SPANISH_VENEZUELA	0x08	/* Spanish (Venezuela) */
232 #define	SUBLANG_SPANISH_COLOMBIA	0x09	/* Spanish (Colombia) */
233 #define	SUBLANG_SPANISH_PERU		0x0a	/* Spanish (Peru) */
234 #define	SUBLANG_SPANISH_ARGENTINA	0x0b	/* Spanish (Argentina) */
235 #define	SUBLANG_SPANISH_ECUADOR		0x0c	/* Spanish (Ecuador) */
236 #define	SUBLANG_SPANISH_CHILE		0x0d	/* Spanish (Chile) */
237 #define	SUBLANG_SPANISH_URUGUAY		0x0e	/* Spanish (Uruguay) */
238 #define	SUBLANG_SPANISH_PARAGUAY	0x0f	/* Spanish (Paraguay) */
239 #define	SUBLANG_SPANISH_BOLIVIA		0x10	/* Spanish (Bolivia) */
240 #define	SUBLANG_SPANISH_EL_SALVADOR	0x11	/* Spanish (El Salvador) */
241 #define	SUBLANG_SPANISH_HONDURAS	0x12	/* Spanish (Honduras) */
242 #define	SUBLANG_SPANISH_NICARAGUA	0x13	/* Spanish (Nicaragua) */
243 #define	SUBLANG_SPANISH_PUERTO_RICO	0x14	/* Spanish (Puerto Rico) */
244 #define	SUBLANG_SWEDISH			0x01	/* Swedish */
245 #define	SUBLANG_SWEDISH_FINLAND		0x02	/* Swedish (Finland) */
246 #define	SUBLANG_URDU_PAKISTAN		0x01	/* Urdu (Pakistan) */
247 #define	SUBLANG_URDU_INDIA		0x02	/* Urdu (India) */
248 #define	SUBLANG_UZBEK_LATIN		0x01	/* Uzbek (Latin) */
249 #define	SUBLANG_UZBEK_CYRILLIC		0x02	/* Uzbek (Cyrillic) */
250 
251 /*
252  * Sorting IDs.
253  */
254 #define	SORT_DEFAULT			0x0	/* sorting default */
255 
256 #define	SORT_JAPANESE_XJIS		0x0	/* Japanese XJIS order */
257 #define	SORT_JAPANESE_UNICODE		0x1	/* Japanese Unicode order */
258 
259 #define	SORT_CHINESE_BIG5		0x0	/* Chinese BIG5 order */
260 #define	SORT_CHINESE_PRCP		0x0	/* PRC Chinese Phonetic order */
261 #define	SORT_CHINESE_UNICODE		0x1	/* Chinese Unicode order */
262 #define	SORT_CHINESE_PRC		0x2	/* PRC Chinese Stroke Count */
263 						/* order */
264 #define	SORT_CHINESE_BOPOMOFO		0x3	/* Traditional Chinese */
265 						/* Bopomofo order */
266 
267 #define	SORT_KOREAN_KSC			0x0	/* Korean KSC order */
268 #define	SORT_KOREAN_UNICODE		0x1	/* Korean Unicode order */
269 
270 #define	SORT_GERMAN_PHONE_BOOK		0x1	/* German Phone Book order */
271 
272 #define	SORT_HUNGARIAN_DEFAULT		0x0	/* Hungarian Default order */
273 #define	SORT_HUNGARIAN_TECHNICAL	0x1	/* Hungarian Technical order */
274 
275 #define	SORT_GEORGIAN_TRADITIONAL	0x0	/* Georgian Traditional order */
276 #define	SORT_GEORGIAN_MODERN		0x1	/* Georgian Modern order */
277 
278 
279 /*
280  *  A locale ID is a 32 bit value which is the combination of a
281  *  language ID, a sort ID, and a reserved area.  The bits are
282  *  allocated as follows:
283  *
284  *       +-------------+---------+-------------------------+
285  *       |   Reserved  | Sort ID |      Language ID        |
286  *       +-------------+---------+-------------------------+
287  *        31         20 19     16 15                      0   bit
288  *
289  *  Locale ID creation/extraction macros:
290  *
291  * MAKELCID            - construct the locale id from a language id
292  *                       and a sort id.
293  * MAKESORTLCID        - construct the locale id from a language id,
294  *                       sort id, and sort version.
295  * LANGIDFROMLCID      - extract the language id from a locale id.
296  * SORTIDFROMLCID      - extract the sort id from a locale id.
297  * SORTVERSIONFROMLCID - extract the sort version from a locale id.
298  */
299 
300 #define	NLS_VALID_LOCALE_MASK	0x000fffff
301 
302 #define	MAKELCID(lgid, srtid)	\
303 	((DWORD)((((DWORD)((WORD)(srtid))) << 16) | ((DWORD)((WORD)(lgid)))))
304 
305 #define	MAKESORTLCID(lgid, srtid, ver)	\
306 	((DWORD)((MAKELCID(lgid, srtid)) | (((DWORD)((WORD)(ver))) << 20)))
307 
308 #define	LANGIDFROMLCID(lcid)		((WORD)(lcid))
309 #define	SORTIDFROMLCID(lcid)		((WORD)((((DWORD)(lcid)) >> 16) & 0xf))
310 #define	SORTVERSIONFROMLCID(lcid)	((WORD)((((DWORD)(lcid)) >> 20) & 0xf))
311 
312 
313 /*
314  * Default System and User IDs for language and locale.
315  */
316 #define	LANG_SYSTEM_DEFAULT	MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
317 #define	LANG_USER_DEFAULT	(MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
318 
319 #define	LOCALE_SYSTEM_DEFAULT	(MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
320 #define	LOCALE_USER_DEFAULT	(MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
321 
322 #define	LOCALE_NEUTRAL         \
323 	(MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT))
324 
325 
326 #ifdef __cplusplus
327 }
328 #endif
329 
330 #endif /* _SMBSRV_NTLOCALE_H */
331