Adding support for resource based error message table
[reactos.git] / reactos / lib / kernel32 / nls / locale.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 Addition copyrights might be specified in LGPL.c
4 * PROJECT: ReactOS system libraries
5 * FILE: lib/kernel32/nls/locale.c
6 * PURPOSE: National language support functions
7 * PROGRAMMER: Boudewijn ( ariadne@xs4all.nl)
8 * UPDATE HISTORY: Modified from Onno Hovers wfc. ( 08/02/99 )
9 Modified from wine. ( 08/02/99 )
10 *
11 */
12
13 /*
14 * nls/locale.c
15 *
16 */
17 /*
18 * OLE2NLS library
19 *
20 * Copyright 1995 Martin von Loewis
21 * Copyright 1998 David Lee Lambert
22 */
23 #undef WIN32_LEAN_AND_MEAN
24 #include<stdlib.h>
25 #include<string.h>
26 #include<windows.h>
27 #include <wchar.h>
28
29 #include <kernel32/thread.h>
30 #include <kernel32/nls.h>
31
32 #undef tolower
33 #undef toupper
34 #undef isupper
35 #undef islower
36 #undef isalnum
37 #undef isalpha
38 #undef isblank
39 #undef isdigit
40
41 #undef towlower
42 #undef towupper
43 #undef iswupper
44 #undef iswlower
45 #undef iswalnum
46 #undef iswalpha
47
48 #define tolower(c) ((c >= 'A' && c <= 'Z') ? c - ( 'A' - 'a' ) : c)
49 #define toupper(c) ((c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c);
50 #define isupper(c) (c >= 'A' && c <= 'Z' )
51 #define islower(c) (c >= 'a' && c <= 'z')
52 #define isalnum(c) ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'))
53 #define isalpha(c) (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')
54 #define isblank(c) ( c == ' ' || c == '\t' )
55 #define isdigit(c) ((c >= '0' && c <= '9'))
56 #define isspace(c) ((c == ' '))
57 #define ispunct(c) ((c == '.'))
58 #define isxdigit(c) ((c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f') || (c >= '0' && c <= '9'))
59 #define iscntrl(c) ((c >=0x00 && c <= 0x1f) || c == 0x7f)
60
61
62 #define towlower(c) ((c >= L'A' && c <= L'Z') ? c - ( L'A' - L'a' ) : c)
63 #define towupper(c) ((c >= L'a' && c <= L'z') ? c + L'A' - L'a' : c);
64 #define iswupper(c) (c >= L'A' && c <= L'Z' )
65 #define iswlower(c) (c >= L'a' && c <= L'z')
66 #define iswalnum(c) ((c >= L'A' && c <= L'Z') || (c >= L'a' && c <= L'z') || (c >= L'0' && c <= L'9'))
67 #define iswalpha(c) (c >= L'A' && c <= L'Z') || (c >= L'a' && c <= L'z')
68
69 /*
70
71 int OLE_GetFormatA(LCID locale,
72 DWORD flags,
73 DWORD tflags,
74 LPSYSTEMTIME xtime,
75 LPCSTR _format,
76 LPSTR date,
77 int datelen);
78 */
79
80 #undef LCID
81
82 #define SYSTEM_DEFAULT_LANGUAGE LANG_ENGLISH
83 #define SYSTEM_DEFAULT_SUBLANGUAGE SUBLANG_ENGLISH_US
84 #define SYSTEM_DEFAULT_SORTORDER SORT_DEFAULT
85
86
87 PLOCALE __UserLocale;
88 PLOCALE __TebLocale;
89 LOCALE __Locale[LOCALE_ARRAY];
90
91 WINBOOL __LocaleInit(void)
92 {
93 PSTR locstr;
94 LCID lcid;
95 PLOCALE plocale=NULL;
96
97 locstr=getenv("WF_LOCALE");
98 if(locstr)
99 {
100 plocale=__Locale;
101 while((plocale->Id)&&(strcasecmp(locstr,plocale->AbbrName)))
102 plocale++;
103 }
104 /* if we do not have a locale, default */
105 if(!plocale)
106 {
107 lcid=MAKELCID(MAKELANGID(SYSTEM_DEFAULT_LANGUAGE,
108 SYSTEM_DEFAULT_SUBLANGUAGE),
109 SYSTEM_DEFAULT_SORTORDER);
110 plocale=__Locale;
111 while((plocale->Id)&&(lcid!=plocale->Id))
112 plocale++;
113 }
114 /* if this does not work, use our disaster plan */
115 if(!plocale)
116 plocale=__Locale;
117
118 __UserLocale=plocale;
119 __TebLocale=plocale;
120 return TRUE;
121 }
122
123 LANGID STDCALL GetUserDefaultLangID(void)
124 {
125 return LANGIDFROMLCID(__UserLocale->Id);
126 }
127
128 #ifndef _OLE2NLS_IN_BUILD_
129
130 LCID
131 STDCALL
132 GetUserDefaultLCID(void)
133 {
134 return __UserLocale->Id;
135 }
136
137 LANGID STDCALL GetSystemDefaultLangID(void)
138 {
139 return MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US);
140 }
141
142 LCID STDCALL GetSystemDefaultLCID(void)
143 {
144 return MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),
145 SORT_DEFAULT);
146 }
147
148 #endif /*_OLE2NLS_IN_BUILD_*/
149
150 LCID STDCALL GetThreadLocale(void)
151 {
152 return __TebLocale;
153 }
154
155 WINBOOL STDCALL SetThreadLocale(LCID Locale)
156 {
157 PLOCALE plocale;
158
159 plocale=__Locale;
160 /* find locale */
161 while((plocale->Id)&&(Locale!=plocale->Id))
162 plocale++;
163 if(!plocale) {
164 SetLastError(ERROR_INVALID_PARAMETER);
165 return FALSE;
166 }
167 __TebLocale=plocale;
168 return TRUE;
169 }
170
171 WINBOOL
172 STDCALL
173 IsValidLocale(
174 LCID Locale,
175 DWORD dwFlags)
176 {
177 PLOCALE plocale;
178
179 plocale=__Locale;
180
181 /* find locale */
182 while((plocale->Id)&&(Locale!=plocale->Id))
183 plocale++;
184 /* is it valid ?? */
185 if(!plocale)
186 return FALSE;
187 else
188 return TRUE;
189 }
190
191 LPSTR static __xtoa(LPSTR str, DWORD val)
192 {
193 LPSTR retstr=str;
194 DWORD hex;
195
196 do
197 {
198 hex=val%16;
199 if(hex<10)
200 *str=val + '0';
201 else
202 *str=val + 'A';
203 val=val/16;
204 str++;
205 }
206 while(val);
207 return retstr;
208 }
209
210 LPWSTR static __xtow(LPWSTR str, DWORD val)
211 {
212 LPWSTR retstr=str;
213 DWORD hex;
214
215 do
216 {
217 hex=val%16;
218 if(hex<10)
219 *str=val + '0';
220 else
221 *str=val + 'A';
222 val=val/16;
223 str++;
224 }
225 while(val);
226 return retstr;
227 }
228
229
230 WINBOOL
231 STDCALL
232 EnumSystemLocalesA(
233 LOCALE_ENUMPROC lpLocaleEnumProc,
234 DWORD dwFlags)
235 {
236 CHAR locstr[10];
237 BOOL retval;
238 PLOCALE plocale;
239
240 if(!lpLocaleEnumProc) {
241 SetLastError(ERROR_INVALID_PARAMETER);
242 return FALSE;
243 }
244
245 plocale=__Locale;
246 retval=TRUE;
247 while((plocale->Id)&&(retval))
248 {
249 __xtoa(locstr,plocale->Id);
250 retval=lpLocaleEnumProc((void *)locstr);
251 }
252 return TRUE;
253 }
254 WINBOOL
255 STDCALL
256 EnumSystemLocalesW(
257 LOCALE_ENUMPROC lpLocaleEnumProc,
258 DWORD dwFlags)
259 {
260 WCHAR locstr[10];
261 WINBOOL retval=TRUE;
262 PLOCALE plocale=__Locale;
263
264
265 if(!lpLocaleEnumProc) {
266 SetLastError(ERROR_INVALID_PARAMETER);
267 return FALSE;
268 }
269
270 while((plocale->Id)&&(retval))
271 {
272 __xtow(locstr,plocale->Id);
273 retval=lpLocaleEnumProc((void *)locstr);
274 }
275 return TRUE;
276 }
277
278 int
279 STDCALL
280 GetLocaleInfoW(
281 LCID Locale,
282 LCTYPE LCType,
283 LPWSTR lpLCData,
284 int cchData)
285 {
286 INT retcnt=0;
287 PLOCALE plocale=__Locale;
288 LPWSTR infostr;
289
290 while(plocale->Id!=Locale)
291 plocale++;
292
293 if(LCType<89)
294 infostr=plocale->Info0[LCType];
295 else if((LCType>0x1000)&&(LCType<0x1011))
296 infostr=plocale->Info1[LCType-0x1000];
297 else
298 { SetLastError(ERROR_INVALID_PARAMETER); return 0; }
299
300 if(cchData)
301 {
302 /* I really need a wide string copy, here */
303 do
304 {
305 *lpLCData=*infostr;
306 infostr++;
307 lpLCData++;
308 cchData--;
309 retcnt++;
310 }
311 while((*infostr)&&(cchData));
312 }
313 else
314 {
315 /* I really need a wide string length, here */
316 do
317 {
318 infostr++;
319 retcnt++;
320 }
321 while(*infostr);
322 }
323 return retcnt;
324 }
325 int
326 STDCALL
327 GetLocaleInfoA(
328 LCID Locale,
329 LCTYPE LCType,
330 LPSTR lpLCData,
331 int cchData)
332 {
333 INT retcnt=0;
334 PLOCALE plocale=__Locale;
335 LPWSTR infostr;
336
337 while(plocale->Id!=Locale)
338 plocale++;
339
340 if(LCType<89)
341 infostr=plocale->Info0[LCType];
342 else if((LCType>0x1000)&&(LCType<0x1011))
343 infostr=plocale->Info1[LCType-0x1000];
344 else
345 { SetLastError(ERROR_INVALID_PARAMETER); return 0; }
346
347 if(cchData)
348 {
349 /* I really need a wide string copy, here */
350 do
351 {
352 *lpLCData=*infostr;
353 infostr++;
354 lpLCData++;
355 cchData--;
356 retcnt++;
357 }
358 while((*infostr)&&(cchData));
359 }
360 else
361 {
362 /* I really need a wide string length, here */
363 do
364 {
365 infostr++;
366 retcnt++;
367 }
368 while(*infostr);
369 }
370 return retcnt;
371 }
372
373 const struct map_lcid2str {
374 LCID langid;
375 const char *langname;
376 } languages[]={
377 {0x0401,"Arabic (Saudi Arabia)"},
378 {0x0801,"Arabic (Iraq)"},
379 {0x0c01,"Arabic (Egypt)"},
380 {0x1001,"Arabic (Libya)"},
381 {0x1401,"Arabic (Algeria)"},
382 {0x1801,"Arabic (Morocco)"},
383 {0x1c01,"Arabic (Tunisia)"},
384 {0x2001,"Arabic (Oman)"},
385 {0x2401,"Arabic (Yemen)"},
386 {0x2801,"Arabic (Syria)"},
387 {0x2c01,"Arabic (Jordan)"},
388 {0x3001,"Arabic (Lebanon)"},
389 {0x3401,"Arabic (Kuwait)"},
390 {0x3801,"Arabic (United Arab Emirates)"},
391 {0x3c01,"Arabic (Bahrain)"},
392 {0x4001,"Arabic (Qatar)"},
393 {0x0402,"Bulgarian"},
394 {0x0403,"Catalan"},
395 {0x0404,"Chinese (Taiwan)"},
396 {0x0804,"Chinese (People's Republic of China)"},
397 {0x0c04,"Chinese (Hong Kong)"},
398 {0x1004,"Chinese (Singapore)"},
399 {0x1404,"Chinese (Macau)"},
400 {0x0405,"Czech"},
401 {0x0406,"Danish"},
402 {0x0407,"German (Germany)"},
403 {0x0807,"German (Switzerland)"},
404 {0x0c07,"German (Austria)"},
405 {0x1007,"German (Luxembourg)"},
406 {0x1407,"German (Liechtenstein)"},
407 {0x0408,"Greek"},
408 {0x0409,"English (United States)"},
409 {0x0809,"English (United Kingdom)"},
410 {0x0c09,"English (Australia)"},
411 {0x1009,"English (Canada)"},
412 {0x1409,"English (New Zealand)"},
413 {0x1809,"English (Ireland)"},
414 {0x1c09,"English (South Africa)"},
415 {0x2009,"English (Jamaica)"},
416 {0x2409,"English (Caribbean)"},
417 {0x2809,"English (Belize)"},
418 {0x2c09,"English (Trinidad)"},
419 {0x3009,"English (Zimbabwe)"},
420 {0x3409,"English (Philippines)"},
421 {0x040a,"Spanish (Spain, traditional sorting)"},
422 {0x080a,"Spanish (Mexico)"},
423 {0x0c0a,"Spanish (Spain, international sorting)"},
424 {0x100a,"Spanish (Guatemala)"},
425 {0x140a,"Spanish (Costa Rica)"},
426 {0x180a,"Spanish (Panama)"},
427 {0x1c0a,"Spanish (Dominican Republic)"},
428 {0x200a,"Spanish (Venezuela)"},
429 {0x240a,"Spanish (Colombia)"},
430 {0x280a,"Spanish (Peru)"},
431 {0x2c0a,"Spanish (Argentina)"},
432 {0x300a,"Spanish (Ecuador)"},
433 {0x340a,"Spanish (Chile)"},
434 {0x380a,"Spanish (Uruguay)"},
435 {0x3c0a,"Spanish (Paraguay)"},
436 {0x400a,"Spanish (Bolivia)"},
437 {0x440a,"Spanish (El Salvador)"},
438 {0x480a,"Spanish (Honduras)"},
439 {0x4c0a,"Spanish (Nicaragua)"},
440 {0x500a,"Spanish (Puerto Rico)"},
441 {0x040b,"Finnish"},
442 {0x040c,"French (France)"},
443 {0x080c,"French (Belgium)"},
444 {0x0c0c,"French (Canada)"},
445 {0x100c,"French (Switzerland)"},
446 {0x140c,"French (Luxembourg)"},
447 {0x180c,"French (Monaco)"},
448 {0x040d,"Hebrew"},
449 {0x040e,"Hungarian"},
450 {0x040f,"Icelandic"},
451 {0x0410,"Italian (Italy)"},
452 {0x0810,"Italian (Switzerland)"},
453 {0x0411,"Japanese"},
454 {0x0412,"Korean (Wansung)"},
455 {0x0812,"Korean (Johab)"},
456 {0x0413,"Dutch (Netherlands)"},
457 {0x0813,"Dutch (Belgium)"},
458 {0x0414,"Norwegian (Bokmal)"},
459 {0x0814,"Norwegian (Nynorsk)"},
460 {0x0415,"Polish"},
461 {0x0416,"Portuguese (Brazil)"},
462 {0x0816,"Portuguese (Portugal)"},
463 {0x0417,"Rhaeto Romanic"},
464 {0x0418,"Romanian"},
465 {0x0818,"Moldavian"},
466 {0x0419,"Russian (Russia)"},
467 {0x0819,"Russian (Moldavia)"},
468 {0x041a,"Croatian"},
469 {0x081a,"Serbian (latin)"},
470 {0x0c1a,"Serbian (cyrillic)"},
471 {0x041b,"Slovak"},
472 {0x041c,"Albanian"},
473 {0x041d,"Swedish (Sweden)"},
474 {0x081d,"Swedish (Finland)"},
475 {0x041e,"Thai"},
476 {0x041f,"Turkish"},
477 {0x0420,"Urdu"},
478 {0x0421,"Indonesian"},
479 {0x0422,"Ukrainian"},
480 {0x0423,"Belarusian"},
481 {0x0424,"Slovene"},
482 {0x0425,"Estonian"},
483 {0x0426,"Latvian"},
484 {0x0427,"Lithuanian (modern)"},
485 {0x0827,"Lithuanian (classic)"},
486 {0x0428,"Maori"},
487 {0x0429,"Farsi"},
488 {0x042a,"Vietnamese"},
489 {0x042b,"Armenian"},
490 {0x042c,"Azeri (latin)"},
491 {0x082c,"Azeri (cyrillic)"},
492 {0x042d,"Basque"},
493 {0x042e,"Sorbian"},
494 {0x042f,"Macedonian"},
495 {0x0430,"Sutu"},
496 {0x0431,"Tsonga"},
497 {0x0432,"Tswana"},
498 {0x0433,"Venda"},
499 {0x0434,"Xhosa"},
500 {0x0435,"Zulu"},
501 {0x0436,"Afrikaans"},
502 {0x0437,"Georgian"},
503 {0x0438,"Faeroese"},
504 {0x0439,"Hindi"},
505 {0x043a,"Maltese"},
506 {0x043b,"Saami"},
507 {0x043c,"Irish gaelic"},
508 {0x083c,"Scottish gaelic"},
509 {0x043e,"Malay (Malaysia)"},
510 {0x083e,"Malay (Brunei Darussalam)"},
511 {0x043f,"Kazak"},
512 {0x0441,"Swahili"},
513 {0x0443,"Uzbek (latin)"},
514 {0x0843,"Uzbek (cyrillic)"},
515 {0x0444,"Tatar"},
516 {0x0445,"Bengali"},
517 {0x0446,"Punjabi"},
518 {0x0447,"Gujarati"},
519 {0x0448,"Oriya"},
520 {0x0449,"Tamil"},
521 {0x044a,"Telugu"},
522 {0x044b,"Kannada"},
523 {0x044c,"Malayalam"},
524 {0x044d,"Assamese"},
525 {0x044e,"Marathi"},
526 {0x044f,"Sanskrit"},
527 {0x0457,"Konkani"},
528 {0x048f,"Esperanto"}, /* Non official */
529 {0x0000,"Unknown"}
530
531 };
532
533
534 static const unsigned char CT_CType2_LUT[] = {
535 C2_NOTAPPLICABLE, /* - 0 */
536 C2_NOTAPPLICABLE, /* - 1 */
537 C2_NOTAPPLICABLE, /* - 2 */
538 C2_NOTAPPLICABLE, /* - 3 */
539 C2_NOTAPPLICABLE, /* - 4 */
540 C2_NOTAPPLICABLE, /* - 5 */
541 C2_NOTAPPLICABLE, /* - 6 */
542 C2_NOTAPPLICABLE, /* - 7 */
543 C2_NOTAPPLICABLE, /* - 8 */
544 C2_SEGMENTSEPARATOR, /* - 9 */
545 C2_NOTAPPLICABLE, /* - 10 */
546 C2_NOTAPPLICABLE, /* - 11 */
547 C2_NOTAPPLICABLE, /* - 12 */
548 C2_NOTAPPLICABLE, /* - 13 */
549 C2_NOTAPPLICABLE, /* - 14 */
550 C2_NOTAPPLICABLE, /* - 15 */
551 C2_NOTAPPLICABLE, /* - 16 */
552 C2_NOTAPPLICABLE, /* - 17 */
553 C2_NOTAPPLICABLE, /* - 18 */
554 C2_NOTAPPLICABLE, /* - 19 */
555 C2_NOTAPPLICABLE, /* - 20 */
556 C2_NOTAPPLICABLE, /* - 21 */
557 C2_NOTAPPLICABLE, /* - 22 */
558 C2_NOTAPPLICABLE, /* - 23 */
559 C2_NOTAPPLICABLE, /* - 24 */
560 C2_NOTAPPLICABLE, /* - 25 */
561 C2_NOTAPPLICABLE, /* - 26 */
562 C2_NOTAPPLICABLE, /* - 27 */
563 C2_NOTAPPLICABLE, /* - 28 */
564 C2_NOTAPPLICABLE, /* - 29 */
565 C2_NOTAPPLICABLE, /* - 30 */
566 C2_NOTAPPLICABLE, /* - 31 */
567 C2_WHITESPACE, /* - 32 */
568 C2_OTHERNEUTRAL, /* ! - 33 */
569 C2_OTHERNEUTRAL, /* " - 34 */ /* " */
570 C2_EUROPETERMINATOR, /* # - 35 */
571 C2_EUROPETERMINATOR, /* $ - 36 */
572 C2_EUROPETERMINATOR, /* % - 37 */
573 C2_LEFTTORIGHT, /* & - 38 */
574 C2_OTHERNEUTRAL, /* ' - 39 */
575 C2_OTHERNEUTRAL, /* ( - 40 */
576 C2_OTHERNEUTRAL, /* ) - 41 */
577 C2_OTHERNEUTRAL, /* * - 42 */
578 C2_EUROPETERMINATOR, /* + - 43 */
579 C2_COMMONSEPARATOR, /* , - 44 */
580 C2_EUROPETERMINATOR, /* - - 45 */
581 C2_EUROPESEPARATOR, /* . - 46 */
582 C2_EUROPESEPARATOR, /* / - 47 */
583 C2_EUROPENUMBER, /* 0 - 48 */
584 C2_EUROPENUMBER, /* 1 - 49 */
585 C2_EUROPENUMBER, /* 2 - 50 */
586 C2_EUROPENUMBER, /* 3 - 51 */
587 C2_EUROPENUMBER, /* 4 - 52 */
588 C2_EUROPENUMBER, /* 5 - 53 */
589 C2_EUROPENUMBER, /* 6 - 54 */
590 C2_EUROPENUMBER, /* 7 - 55 */
591 C2_EUROPENUMBER, /* 8 - 56 */
592 C2_EUROPENUMBER, /* 9 - 57 */
593 C2_COMMONSEPARATOR, /* : - 58 */
594 C2_OTHERNEUTRAL, /* ; - 59 */
595 C2_OTHERNEUTRAL, /* < - 60 */
596 C2_OTHERNEUTRAL, /* = - 61 */
597 C2_OTHERNEUTRAL, /* > - 62 */
598 C2_OTHERNEUTRAL, /* ? - 63 */
599 C2_LEFTTORIGHT, /* @ - 64 */
600 C2_LEFTTORIGHT, /* A - 65 */
601 C2_LEFTTORIGHT, /* B - 66 */
602 C2_LEFTTORIGHT, /* C - 67 */
603 C2_LEFTTORIGHT, /* D - 68 */
604 C2_LEFTTORIGHT, /* E - 69 */
605 C2_LEFTTORIGHT, /* F - 70 */
606 C2_LEFTTORIGHT, /* G - 71 */
607 C2_LEFTTORIGHT, /* H - 72 */
608 C2_LEFTTORIGHT, /* I - 73 */
609 C2_LEFTTORIGHT, /* J - 74 */
610 C2_LEFTTORIGHT, /* K - 75 */
611 C2_LEFTTORIGHT, /* L - 76 */
612 C2_LEFTTORIGHT, /* M - 77 */
613 C2_LEFTTORIGHT, /* N - 78 */
614 C2_LEFTTORIGHT, /* O - 79 */
615 C2_LEFTTORIGHT, /* P - 80 */
616 C2_LEFTTORIGHT, /* Q - 81 */
617 C2_LEFTTORIGHT, /* R - 82 */
618 C2_LEFTTORIGHT, /* S - 83 */
619 C2_LEFTTORIGHT, /* T - 84 */
620 C2_LEFTTORIGHT, /* U - 85 */
621 C2_LEFTTORIGHT, /* V - 86 */
622 C2_LEFTTORIGHT, /* W - 87 */
623 C2_LEFTTORIGHT, /* X - 88 */
624 C2_LEFTTORIGHT, /* Y - 89 */
625 C2_LEFTTORIGHT, /* Z - 90 */
626 C2_OTHERNEUTRAL, /* [ - 91 */
627 C2_OTHERNEUTRAL, /* \ - 92 */
628 C2_OTHERNEUTRAL, /* ] - 93 */
629 C2_OTHERNEUTRAL, /* ^ - 94 */
630 C2_OTHERNEUTRAL, /* _ - 95 */
631 C2_OTHERNEUTRAL, /* ` - 96 */
632 C2_LEFTTORIGHT, /* a - 97 */
633 C2_LEFTTORIGHT, /* b - 98 */
634 C2_LEFTTORIGHT, /* c - 99 */
635 C2_LEFTTORIGHT, /* d - 100 */
636 C2_LEFTTORIGHT, /* e - 101 */
637 C2_LEFTTORIGHT, /* f - 102 */
638 C2_LEFTTORIGHT, /* g - 103 */
639 C2_LEFTTORIGHT, /* h - 104 */
640 C2_LEFTTORIGHT, /* i - 105 */
641 C2_LEFTTORIGHT, /* j - 106 */
642 C2_LEFTTORIGHT, /* k - 107 */
643 C2_LEFTTORIGHT, /* l - 108 */
644 C2_LEFTTORIGHT, /* m - 109 */
645 C2_LEFTTORIGHT, /* n - 110 */
646 C2_LEFTTORIGHT, /* o - 111 */
647 C2_LEFTTORIGHT, /* p - 112 */
648 C2_LEFTTORIGHT, /* q - 113 */
649 C2_LEFTTORIGHT, /* r - 114 */
650 C2_LEFTTORIGHT, /* s - 115 */
651 C2_LEFTTORIGHT, /* t - 116 */
652 C2_LEFTTORIGHT, /* u - 117 */
653 C2_LEFTTORIGHT, /* v - 118 */
654 C2_LEFTTORIGHT, /* w - 119 */
655 C2_LEFTTORIGHT, /* x - 120 */
656 C2_LEFTTORIGHT, /* y - 121 */
657 C2_LEFTTORIGHT, /* z - 122 */
658 C2_OTHERNEUTRAL, /* { - 123 */
659 C2_OTHERNEUTRAL, /* | - 124 */
660 C2_OTHERNEUTRAL, /* } - 125 */
661 C2_OTHERNEUTRAL, /* ~ - 126 */
662 C2_NOTAPPLICABLE, /* \7f - 127 */
663 C2_NOTAPPLICABLE, /* \80 - 128 */
664 C2_NOTAPPLICABLE, /* \81 - 129 */
665 C2_OTHERNEUTRAL, /* \82 - 130 */
666 C2_LEFTTORIGHT, /* \83 - 131 */
667 C2_OTHERNEUTRAL, /* \84 - 132 */
668 C2_OTHERNEUTRAL, /* \85 - 133 */
669 C2_OTHERNEUTRAL, /* \86 - 134 */
670 C2_OTHERNEUTRAL, /* \87 - 135 */
671 C2_LEFTTORIGHT, /* \88 - 136 */
672 C2_EUROPETERMINATOR, /* \89 - 137 */
673 C2_LEFTTORIGHT, /* \8a - 138 */
674 C2_OTHERNEUTRAL, /* \8b - 139 */
675 C2_LEFTTORIGHT, /* \8c - 140 */
676 C2_NOTAPPLICABLE, /* \8d - 141 */
677 C2_NOTAPPLICABLE, /* \8e - 142 */
678 C2_NOTAPPLICABLE, /* \8f - 143 */
679 C2_NOTAPPLICABLE, /* \90 - 144 */
680 C2_OTHERNEUTRAL, /* \91 - 145 */
681 C2_OTHERNEUTRAL, /* \92 - 146 */
682 C2_OTHERNEUTRAL, /* \93 - 147 */
683 C2_OTHERNEUTRAL, /* \94 - 148 */
684 C2_OTHERNEUTRAL, /* \95 - 149 */
685 C2_OTHERNEUTRAL, /* \96 - 150 */
686 C2_OTHERNEUTRAL, /* \97 - 151 */
687 C2_LEFTTORIGHT, /* \98 - 152 */
688 C2_OTHERNEUTRAL, /* \99 - 153 */
689 C2_LEFTTORIGHT, /* \9a - 154 */
690 C2_OTHERNEUTRAL, /* \9b - 155 */
691 C2_LEFTTORIGHT, /* \9c - 156 */
692 C2_NOTAPPLICABLE, /* \9d - 157 */
693 C2_NOTAPPLICABLE, /* \9e - 158 */
694 C2_LEFTTORIGHT, /* \9f - 159 */
695 C2_WHITESPACE, /*   - 160 */
696 C2_OTHERNEUTRAL, /* ¡ - 161 */
697 C2_EUROPETERMINATOR, /* ¢ - 162 */
698 C2_EUROPETERMINATOR, /* £ - 163 */
699 C2_EUROPETERMINATOR, /* ¤ - 164 */
700 C2_EUROPETERMINATOR, /* ¥ - 165 */
701 C2_OTHERNEUTRAL, /* ¦ - 166 */
702 C2_OTHERNEUTRAL, /* § - 167 */
703 C2_OTHERNEUTRAL, /* ¨ - 168 */
704 C2_OTHERNEUTRAL, /* © - 169 */
705 C2_OTHERNEUTRAL, /* ª - 170 */
706 C2_OTHERNEUTRAL, /* « - 171 */
707 C2_OTHERNEUTRAL, /* ¬ - 172 */
708 C2_OTHERNEUTRAL, /* ­ - 173 */
709 C2_OTHERNEUTRAL, /* ® - 174 */
710 C2_OTHERNEUTRAL, /* ¯ - 175 */
711 C2_EUROPETERMINATOR, /* ° - 176 */
712 C2_EUROPETERMINATOR, /* ± - 177 */
713 C2_EUROPENUMBER, /* ² - 178 */
714 C2_EUROPENUMBER, /* ³ - 179 */
715 C2_OTHERNEUTRAL, /* ´ - 180 */
716 C2_OTHERNEUTRAL, /* µ - 181 */
717 C2_OTHERNEUTRAL, /* ¶ - 182 */
718 C2_OTHERNEUTRAL, /* · - 183 */
719 C2_OTHERNEUTRAL, /* ¸ - 184 */
720 C2_EUROPENUMBER, /* ¹ - 185 */
721 C2_OTHERNEUTRAL, /* º - 186 */
722 C2_OTHERNEUTRAL, /* » - 187 */
723 C2_OTHERNEUTRAL, /* ¼ - 188 */
724 C2_OTHERNEUTRAL, /* ½ - 189 */
725 C2_OTHERNEUTRAL, /* ¾ - 190 */
726 C2_OTHERNEUTRAL, /* ¿ - 191 */
727 C2_LEFTTORIGHT, /* À - 192 */
728 C2_LEFTTORIGHT, /* Á - 193 */
729 C2_LEFTTORIGHT, /* Â - 194 */
730 C2_LEFTTORIGHT, /* Ã - 195 */
731 C2_LEFTTORIGHT, /* Ä - 196 */
732 C2_LEFTTORIGHT, /* Å - 197 */
733 C2_LEFTTORIGHT, /* Æ - 198 */
734 C2_LEFTTORIGHT, /* Ç - 199 */
735 C2_LEFTTORIGHT, /* È - 200 */
736 C2_LEFTTORIGHT, /* É - 201 */
737 C2_LEFTTORIGHT, /* Ê - 202 */
738 C2_LEFTTORIGHT, /* Ë - 203 */
739 C2_LEFTTORIGHT, /* Ì - 204 */
740 C2_LEFTTORIGHT, /* Í - 205 */
741 C2_LEFTTORIGHT, /* Î - 206 */
742 C2_LEFTTORIGHT, /* Ï - 207 */
743 C2_LEFTTORIGHT, /* Ð - 208 */
744 C2_LEFTTORIGHT, /* Ñ - 209 */
745 C2_LEFTTORIGHT, /* Ò - 210 */
746 C2_LEFTTORIGHT, /* Ó - 211 */
747 C2_LEFTTORIGHT, /* Ô - 212 */
748 C2_LEFTTORIGHT, /* Õ - 213 */
749 C2_LEFTTORIGHT, /* Ö - 214 */
750 C2_OTHERNEUTRAL, /* × - 215 */
751 C2_LEFTTORIGHT, /* Ø - 216 */
752 C2_LEFTTORIGHT, /* Ù - 217 */
753 C2_LEFTTORIGHT, /* Ú - 218 */
754 C2_LEFTTORIGHT, /* Û - 219 */
755 C2_LEFTTORIGHT, /* Ü - 220 */
756 C2_LEFTTORIGHT, /* Ý - 221 */
757 C2_LEFTTORIGHT, /* Þ - 222 */
758 C2_LEFTTORIGHT, /* ß - 223 */
759 C2_LEFTTORIGHT, /* à - 224 */
760 C2_LEFTTORIGHT, /* á - 225 */
761 C2_LEFTTORIGHT, /* â - 226 */
762 C2_LEFTTORIGHT, /* ã - 227 */
763 C2_LEFTTORIGHT, /* ä - 228 */
764 C2_LEFTTORIGHT, /* å - 229 */
765 C2_LEFTTORIGHT, /* æ - 230 */
766 C2_LEFTTORIGHT, /* ç - 231 */
767 C2_LEFTTORIGHT, /* è - 232 */
768 C2_LEFTTORIGHT, /* é - 233 */
769 C2_LEFTTORIGHT, /* ê - 234 */
770 C2_LEFTTORIGHT, /* ë - 235 */
771 C2_LEFTTORIGHT, /* ì - 236 */
772 C2_LEFTTORIGHT, /* í - 237 */
773 C2_LEFTTORIGHT, /* î - 238 */
774 C2_LEFTTORIGHT, /* ï - 239 */
775 C2_LEFTTORIGHT, /* ð - 240 */
776 C2_LEFTTORIGHT, /* ñ - 241 */
777 C2_LEFTTORIGHT, /* ò - 242 */
778 C2_LEFTTORIGHT, /* ó - 243 */
779 C2_LEFTTORIGHT, /* ô - 244 */
780 C2_LEFTTORIGHT, /* õ - 245 */
781 C2_LEFTTORIGHT, /* ö - 246 */
782 C2_OTHERNEUTRAL, /* ÷ - 247 */
783 C2_LEFTTORIGHT, /* ø - 248 */
784 C2_LEFTTORIGHT, /* ù - 249 */
785 C2_LEFTTORIGHT, /* ú - 250 */
786 C2_LEFTTORIGHT, /* û - 251 */
787 C2_LEFTTORIGHT, /* ü - 252 */
788 C2_LEFTTORIGHT, /* ý - 253 */
789 C2_LEFTTORIGHT, /* þ - 254 */
790 C2_LEFTTORIGHT /* ÿ - 255 */
791 };
792
793 static const WORD CT_CType3_LUT[] = {
794 0x0000, /* - 0 */
795 0x0000, /* - 1 */
796 0x0000, /* - 2 */
797 0x0000, /* - 3 */
798 0x0000, /* - 4 */
799 0x0000, /* - 5 */
800 0x0000, /* - 6 */
801 0x0000, /* - 7 */
802 0x0000, /* - 8 */
803 0x0008, /* - 9 */
804 0x0008, /* - 10 */
805 0x0008, /* - 11 */
806 0x0008, /* - 12 */
807 0x0008, /* - 13 */
808 0x0000, /* - 14 */
809 0x0000, /* - 15 */
810 0x0000, /* - 16 */
811 0x0000, /* - 17 */
812 0x0000, /* - 18 */
813 0x0000, /* - 19 */
814 0x0000, /* - 20 */
815 0x0000, /* - 21 */
816 0x0000, /* - 22 */
817 0x0000, /* - 23 */
818 0x0000, /* - 24 */
819 0x0000, /* - 25 */
820 0x0000, /* - 26 */
821 0x0000, /* - 27 */
822 0x0000, /* - 28 */
823 0x0000, /* - 29 */
824 0x0000, /* - 30 */
825 0x0000, /* - 31 */
826 0x0048, /* - 32 */
827 0x0048, /* ! - 33 */
828 0x0448, /* " - 34 */ /* " */
829 0x0048, /* # - 35 */
830 0x0448, /* $ - 36 */
831 0x0048, /* % - 37 */
832 0x0048, /* & - 38 */
833 0x0440, /* ' - 39 */
834 0x0048, /* ( - 40 */
835 0x0048, /* ) - 41 */
836 0x0048, /* * - 42 */
837 0x0048, /* + - 43 */
838 0x0048, /* , - 44 */
839 0x0440, /* - - 45 */
840 0x0048, /* . - 46 */
841 0x0448, /* / - 47 */
842 0x0040, /* 0 - 48 */
843 0x0040, /* 1 - 49 */
844 0x0040, /* 2 - 50 */
845 0x0040, /* 3 - 51 */
846 0x0040, /* 4 - 52 */
847 0x0040, /* 5 - 53 */
848 0x0040, /* 6 - 54 */
849 0x0040, /* 7 - 55 */
850 0x0040, /* 8 - 56 */
851 0x0040, /* 9 - 57 */
852 0x0048, /* : - 58 */
853 0x0048, /* ; - 59 */
854 0x0048, /* < - 60 */
855 0x0448, /* = - 61 */
856 0x0048, /* > - 62 */
857 0x0048, /* ? - 63 */
858 0x0448, /* @ - 64 */
859 0x8040, /* A - 65 */
860 0x8040, /* B - 66 */
861 0x8040, /* C - 67 */
862 0x8040, /* D - 68 */
863 0x8040, /* E - 69 */
864 0x8040, /* F - 70 */
865 0x8040, /* G - 71 */
866 0x8040, /* H - 72 */
867 0x8040, /* I - 73 */
868 0x8040, /* J - 74 */
869 0x8040, /* K - 75 */
870 0x8040, /* L - 76 */
871 0x8040, /* M - 77 */
872 0x8040, /* N - 78 */
873 0x8040, /* O - 79 */
874 0x8040, /* P - 80 */
875 0x8040, /* Q - 81 */
876 0x8040, /* R - 82 */
877 0x8040, /* S - 83 */
878 0x8040, /* T - 84 */
879 0x8040, /* U - 85 */
880 0x8040, /* V - 86 */
881 0x8040, /* W - 87 */
882 0x8040, /* X - 88 */
883 0x8040, /* Y - 89 */
884 0x8040, /* Z - 90 */
885 0x0048, /* [ - 91 */
886 0x0448, /* \ - 92 */
887 0x0048, /* ] - 93 */
888 0x0448, /* ^ - 94 */
889 0x0448, /* _ - 95 */
890 0x0448, /* ` - 96 */
891 0x8040, /* a - 97 */
892 0x8040, /* b - 98 */
893 0x8040, /* c - 99 */
894 0x8040, /* d - 100 */
895 0x8040, /* e - 101 */
896 0x8040, /* f - 102 */
897 0x8040, /* g - 103 */
898 0x8040, /* h - 104 */
899 0x8040, /* i - 105 */
900 0x8040, /* j - 106 */
901 0x8040, /* k - 107 */
902 0x8040, /* l - 108 */
903 0x8040, /* m - 109 */
904 0x8040, /* n - 110 */
905 0x8040, /* o - 111 */
906 0x8040, /* p - 112 */
907 0x8040, /* q - 113 */
908 0x8040, /* r - 114 */
909 0x8040, /* s - 115 */
910 0x8040, /* t - 116 */
911 0x8040, /* u - 117 */
912 0x8040, /* v - 118 */
913 0x8040, /* w - 119 */
914 0x8040, /* x - 120 */
915 0x8040, /* y - 121 */
916 0x8040, /* z - 122 */
917 0x0048, /* { - 123 */
918 0x0048, /* | - 124 */
919 0x0048, /* } - 125 */
920 0x0448, /* ~ - 126 */
921 0x0000, /* \7f - 127 */
922 0x0000, /* \80 - 128 */
923 0x0000, /* \81 - 129 */
924 0x0008, /* \82 - 130 */
925 0x8000, /* \83 - 131 */
926 0x0008, /* \84 - 132 */
927 0x0008, /* \85 - 133 */
928 0x0008, /* \86 - 134 */
929 0x0008, /* \87 - 135 */
930 0x0001, /* \88 - 136 */
931 0x0008, /* \89 - 137 */
932 0x8003, /* \8a - 138 */
933 0x0008, /* \8b - 139 */
934 0x8000, /* \8c - 140 */
935 0x0000, /* \8d - 141 */
936 0x0000, /* \8e - 142 */
937 0x0000, /* \8f - 143 */
938 0x0000, /* \90 - 144 */
939 0x0088, /* \91 - 145 */
940 0x0088, /* \92 - 146 */
941 0x0088, /* \93 - 147 */
942 0x0088, /* \94 - 148 */
943 0x0008, /* \95 - 149 */
944 0x0400, /* \96 - 150 */
945 0x0400, /* \97 - 151 */
946 0x0408, /* \98 - 152 */
947 0x0000, /* \99 - 153 */
948 0x8003, /* \9a - 154 */
949 0x0008, /* \9b - 155 */
950 0x8000, /* \9c - 156 */
951 0x0000, /* \9d - 157 */
952 0x0000, /* \9e - 158 */
953 0x8003, /* \9f - 159 */
954 0x0008, /*   - 160 */
955 0x0008, /* ¡ - 161 */
956 0x0048, /* ¢ - 162 */
957 0x0048, /* £ - 163 */
958 0x0008, /* ¤ - 164 */
959 0x0048, /* ¥ - 165 */
960 0x0048, /* ¦ - 166 */
961 0x0008, /* § - 167 */
962 0x0408, /* ¨ - 168 */
963 0x0008, /* © - 169 */
964 0x0400, /* ª - 170 */
965 0x0008, /* « - 171 */
966 0x0048, /* ¬ - 172 */
967 0x0408, /* ­ - 173 */
968 0x0008, /* ® - 174 */
969 0x0448, /* ¯ - 175 */
970 0x0008, /* ° - 176 */
971 0x0008, /* ± - 177 */
972 0x0000, /* ² - 178 */
973 0x0000, /* ³ - 179 */
974 0x0408, /* ´ - 180 */
975 0x0008, /* µ - 181 */
976 0x0008, /* ¶ - 182 */
977 0x0008, /* · - 183 */
978 0x0408, /* ¸ - 184 */
979 0x0000, /* ¹ - 185 */
980 0x0400, /* º - 186 */
981 0x0008, /* » - 187 */
982 0x0000, /* ¼ - 188 */
983 0x0000, /* ½ - 189 */
984 0x0000, /* ¾ - 190 */
985 0x0008, /* ¿ - 191 */
986 0x8003, /* À - 192 */
987 0x8003, /* Á - 193 */
988 0x8003, /* Â - 194 */
989 0x8003, /* Ã - 195 */
990 0x8003, /* Ä - 196 */
991 0x8003, /* Å - 197 */
992 0x8000, /* Æ - 198 */
993 0x8003, /* Ç - 199 */
994 0x8003, /* È - 200 */
995 0x8003, /* É - 201 */
996 0x8003, /* Ê - 202 */
997 0x8003, /* Ë - 203 */
998 0x8003, /* Ì - 204 */
999 0x8003, /* Í - 205 */
1000 0x8003, /* Î - 206 */
1001 0x8003, /* Ï - 207 */
1002 0x8000, /* Ð - 208 */
1003 0x8003, /* Ñ - 209 */
1004 0x8003, /* Ò - 210 */
1005 0x8003, /* Ó - 211 */
1006 0x8003, /* Ô - 212 */
1007 0x8003, /* Õ - 213 */
1008 0x8003, /* Ö - 214 */
1009 0x0008, /* × - 215 */
1010 0x8003, /* Ø - 216 */
1011 0x8003, /* Ù - 217 */
1012 0x8003, /* Ú - 218 */
1013 0x8003, /* Û - 219 */
1014 0x8003, /* Ü - 220 */
1015 0x8003, /* Ý - 221 */
1016 0x8000, /* Þ - 222 */
1017 0x8000, /* ß - 223 */
1018 0x8003, /* à - 224 */
1019 0x8003, /* á - 225 */
1020 0x8003, /* â - 226 */
1021 0x8003, /* ã - 227 */
1022 0x8003, /* ä - 228 */
1023 0x8003, /* å - 229 */
1024 0x8000, /* æ - 230 */
1025 0x8003, /* ç - 231 */
1026 0x8003, /* è - 232 */
1027 0x8003, /* é - 233 */
1028 0x8003, /* ê - 234 */
1029 0x8003, /* ë - 235 */
1030 0x8003, /* ì - 236 */
1031 0x8003, /* í - 237 */
1032 0x8003, /* î - 238 */
1033 0x8003, /* ï - 239 */
1034 0x8000, /* ð - 240 */
1035 0x8003, /* ñ - 241 */
1036 0x8003, /* ò - 242 */
1037 0x8003, /* ó - 243 */
1038 0x8003, /* ô - 244 */
1039 0x8003, /* õ - 245 */
1040 0x8003, /* ö - 246 */
1041 0x0008, /* ÷ - 247 */
1042 0x8003, /* ø - 248 */
1043 0x8003, /* ù - 249 */
1044 0x8003, /* ú - 250 */
1045 0x8003, /* û - 251 */
1046 0x8003, /* ü - 252 */
1047 0x8003, /* ý - 253 */
1048 0x8000, /* þ - 254 */
1049 0x8003 /* ÿ - 255 */
1050 };
1051
1052
1053
1054 WINBOOL
1055 STDCALL
1056 GetStringTypeExA(
1057 LCID Locale,
1058 DWORD dwInfoType,
1059 LPCSTR lpSrcStr,
1060 int cchSrc,
1061 LPWORD lpCharType)
1062 {
1063 int i;
1064
1065 if ((lpSrcStr==NULL) || (lpCharType==NULL) || (lpSrcStr==(LPCSTR)lpCharType))
1066 {
1067 SetLastError(ERROR_INVALID_PARAMETER);
1068 return FALSE;
1069 }
1070
1071 if (cchSrc==-1)
1072 cchSrc=lstrlenA(lpSrcStr)+1;
1073
1074 switch (dwInfoType) {
1075 case CT_CTYPE1:
1076 for (i=0;i<cchSrc;i++)
1077 {
1078 lpCharType[i] = 0;
1079 if (isdigit(lpSrcStr[i])) lpCharType[i]|=C1_DIGIT;
1080 if (isalpha(lpSrcStr[i])) lpCharType[i]|=C1_ALPHA;
1081 if (islower(lpSrcStr[i])) lpCharType[i]|=C1_LOWER;
1082 if (isupper(lpSrcStr[i])) lpCharType[i]|=C1_UPPER;
1083 if (isspace(lpSrcStr[i])) lpCharType[i]|=C1_SPACE;
1084 if (ispunct(lpSrcStr[i])) lpCharType[i]|=C1_PUNCT;
1085 if (iscntrl(lpSrcStr[i])) lpCharType[i]|=C1_CNTRL;
1086 if (isblank(lpSrcStr[i])) lpCharType[i]|=C1_BLANK;
1087 if (isxdigit(lpSrcStr[i])) lpCharType[i]|=C1_XDIGIT;
1088 }
1089 return TRUE;
1090
1091 case CT_CTYPE2:
1092 for (i=0;i<cchSrc;i++)
1093 {
1094 lpCharType[i]=(WORD)CT_CType2_LUT[i];
1095 }
1096 return TRUE;
1097
1098 case CT_CTYPE3:
1099 for (i=0;i<cchSrc;i++)
1100 {
1101 lpCharType[i]=CT_CType3_LUT[i];
1102 }
1103 return TRUE;
1104
1105 default:
1106 return FALSE;
1107 }
1108 }
1109
1110 WINBOOL
1111 STDCALL
1112 GetStringTypeA(
1113 LCID Locale,
1114 DWORD dwInfoType,
1115 LPCSTR lpSrcStr,
1116 int cchSrc,
1117 LPWORD lpCharType)
1118 {
1119 return GetStringTypeExA(Locale, dwInfoType, lpSrcStr, cchSrc, lpCharType);
1120 }
1121
1122 WINBOOL
1123 STDCALL
1124 GetStringTypeExW(
1125 LCID Locale,
1126 DWORD dwInfoType,
1127 LPCWSTR lpSrcStr,
1128 int cchSrc,
1129 LPWORD lpCharType)
1130 {
1131 int i;
1132
1133 if ((lpSrcStr==NULL) || (lpCharType==NULL) || (lpSrcStr==(LPCWSTR)lpCharType))
1134 {
1135 SetLastError(ERROR_INVALID_PARAMETER);
1136 return FALSE;
1137 }
1138
1139 if (cchSrc==-1)
1140 cchSrc=lstrlenW(lpSrcStr)+1;
1141
1142 switch (dwInfoType) {
1143 case CT_CTYPE1:
1144 for (i=0;i<cchSrc;i++)
1145 {
1146 lpCharType[i] = 0;
1147 if (isdigit(lpSrcStr[i])) lpCharType[i]|=C1_DIGIT;
1148 if (iswalpha(lpSrcStr[i])) lpCharType[i]|=C1_ALPHA;
1149 if (iswlower(lpSrcStr[i])) lpCharType[i]|=C1_LOWER;
1150 if (iswupper(lpSrcStr[i])) lpCharType[i]|=C1_UPPER;
1151 if (isspace(lpSrcStr[i])) lpCharType[i]|=C1_SPACE;
1152 if (ispunct(lpSrcStr[i])) lpCharType[i]|=C1_PUNCT;
1153 if (iscntrl(lpSrcStr[i])) lpCharType[i]|=C1_CNTRL;
1154 if (isblank(lpSrcStr[i])) lpCharType[i]|=C1_BLANK;
1155 if (isxdigit(lpSrcStr[i])) lpCharType[i]|=C1_XDIGIT;
1156 }
1157 return TRUE;
1158
1159 case CT_CTYPE2:
1160 for (i=0;i<cchSrc;i++)
1161 {
1162 lpCharType[i]=(WORD)CT_CType2_LUT[i];
1163 }
1164 return TRUE;
1165
1166 case CT_CTYPE3:
1167 for (i=0;i<cchSrc;i++)
1168 {
1169 lpCharType[i]=CT_CType3_LUT[i];
1170 }
1171 return TRUE;
1172
1173 default:
1174 return FALSE;
1175 }
1176 }
1177
1178 WINBOOL
1179 STDCALL
1180 GetStringTypeW(
1181 DWORD dwInfoType,
1182 LPCWSTR lpSrcStr,
1183 int cchSrc,
1184 LPWORD lpCharType)
1185 {
1186 LCID Locale = GetThreadLocale();
1187 return GetStringTypeExW(Locale, dwInfoType, lpSrcStr, cchSrc, lpCharType);
1188 }
1189
1190 DWORD
1191 STDCALL
1192 VerLanguageNameA(
1193 DWORD wLang,
1194 LPSTR szLang,
1195 DWORD nSize
1196 )
1197 {
1198 int i;
1199 int len;
1200 for (i=0;languages[i].langid!=0;i++)
1201 if (wLang==languages[i].langid)
1202 break;
1203
1204 len = min(strlen(languages[i].langname),nSize);
1205 strncpy(szLang,languages[i].langname,len);
1206 return len;
1207 }
1208
1209 DWORD
1210 STDCALL
1211 VerLanguageNameW(
1212 DWORD wLang,
1213 LPWSTR szLang,
1214 DWORD nSize
1215 )
1216 {
1217 int i,j;
1218
1219 for (i=0;languages[i].langid!=0;i++)
1220 if (wLang==languages[i].langid)
1221 break;
1222 for(j=0;j<nSize && languages[i].langname[j] != 0 ;i++)
1223 szLang[j] = languages[i].langname[j];
1224 szLang[j] = 0;
1225 return strlen(languages[i].langname);
1226 }
1227
1228
1229
1230
1231 int
1232 STDCALL
1233 GetDateFormatW(
1234 LCID Locale,
1235 DWORD dwFlags,
1236 CONST SYSTEMTIME *lpDate,
1237 LPCWSTR lpFormat,
1238 LPWSTR lpDateStr,
1239 int cchDate)
1240 {
1241 return 0;
1242 }
1243
1244 /******************************************************************************
1245 * GetDateFormatA [KERNEL32.310]
1246 * Makes an ASCII string of the date
1247 *
1248 * This function uses format to format the date, or, if format
1249 * is NULL, uses the default for the locale. format is a string
1250 * of literal fields and characters as follows:
1251 *
1252 * - d single-digit (no leading zero) day (of month)
1253 * - dd two-digit day (of month)
1254 * - ddd short day-of-week name
1255 * - dddd long day-of-week name
1256 * - M single-digit month
1257 * - MM two-digit month
1258 * - MMM short month name
1259 * - MMMM full month name
1260 * - y two-digit year, no leading 0
1261 * - yy two-digit year
1262 * - yyyy four-digit year
1263 * - gg era string
1264 *
1265 */
1266
1267 #if 0
1268
1269 int STDCALL GetDateFormatA(LCID locale,DWORD flags,
1270 CONST SYSTEMTIME *xtime,
1271 LPCSTR format, LPSTR date,int datelen)
1272 {
1273
1274 char format_buf[40];
1275 LPCSTR thisformat;
1276 SYSTEMTIME t;
1277 LPSYSTEMTIME thistime;
1278 LCID thislocale;
1279 INT ret;
1280
1281
1282
1283 thislocale = OLE2NLS_CheckLocale ( locale );
1284
1285 if (xtime == NULL) {
1286 GetSystemTime(&t);
1287 thisti
1288
1289
1290 #endif