17#define TOUPPER(c) (c & ~0x20)
18#define TOLOWER(c) (c | 0x20)
19#define ISALPHA(c) ((unsigned)(TOUPPER(c) - 'A') < 26)
22#define XSLTMAX_ISO639LANGLEN 8
23#define XSLTMAX_ISO3166CNTRYLEN 8
25#define XSLTMAX_LANGTAGLEN (XSLTMAX_ISO639LANGLEN+1+XSLTMAX_ISO3166CNTRYLEN)
29#ifdef XSLT_LOCALE_WINAPI
32struct xsltRFC1766Info_s {
38typedef struct xsltRFC1766Info_s xsltRFC1766Info;
40static int xsltLocaleListSize = 0;
41static xsltRFC1766Info *xsltLocaleList =
NULL;
45xslt_locale_WINAPI(
const xmlChar *languageTag) {
47 xsltRFC1766Info *
p = xsltLocaleList;
49 for (
k=0;
k<xsltLocaleListSize;
k++,
p++)
50 if (
xmlStrcmp(
p->tag, languageTag) == 0)
return p->lcid;
54static void xsltEnumSupportedLocales(
void);
64#ifdef XSLT_LOCALE_WINAPI
67 xsltLocaleList =
NULL;
83#ifdef XSLT_LOCALE_POSIX
87 const char *region =
NULL;
93 if (languageTag ==
NULL)
116 locale = newlocale(LC_COLLATE_MASK, localeName,
NULL);
122 q = localeName + llen;
128 locale = newlocale(LC_COLLATE_MASK, localeName,
NULL);
141 q = localeName + llen;
146 locale = newlocale(LC_COLLATE_MASK, localeName,
NULL);
151#ifdef XSLT_LOCALE_WINAPI
160 if (languageTag ==
NULL)
goto end;
162 xsltEnumSupportedLocales();
166 if (
i == 0)
goto end;
171 if (*
p++ !=
'-')
goto end;
175 if (
i == 0 || *
p)
goto end;
178 locale = xslt_locale_WINAPI(localeName);
185 strcpy((
char *) localeName + llen + 1, (
char *) region);
186 locale = xslt_locale_WINAPI(localeName);
192#ifdef XSLT_LOCALE_NONE
201 const char *region =
NULL;
206 switch (localeName[0]) {
208 if (
c ==
'a' ||
c ==
'm') region =
"ET";
209 else if (
c ==
'f') region =
"ZA";
210 else if (
c ==
'n') region =
"ES";
211 else if (
c ==
'r') region =
"AE";
212 else if (
c ==
'z') region =
"AZ";
215 if (
c ==
'e') region =
"BY";
216 else if (
c ==
'g') region =
"BG";
217 else if (
c ==
'n') region =
"BD";
218 else if (
c ==
'r') region =
"FR";
219 else if (
c ==
's') region =
"BA";
222 if (
c ==
'a') region =
"ES";
223 else if (
c ==
's') region =
"CZ";
224 else if (
c ==
'y') region =
"GB";
227 if (
c ==
'a') region =
"DK";
228 else if (
c ==
'e') region =
"DE";
231 if (
c ==
'l') region =
"GR";
232 else if (
c ==
'n' ||
c ==
'o') region =
"US";
233 else if (
c ==
's' ||
c ==
'u') region =
"ES";
234 else if (
c ==
't') region =
"EE";
237 if (
c ==
'a') region =
"IR";
238 else if (
c ==
'i') region =
"FI";
239 else if (
c ==
'o') region =
"FO";
240 else if (
c ==
'r') region =
"FR";
243 if (
c ==
'a') region =
"IE";
244 else if (
c ==
'l') region =
"ES";
245 else if (
c ==
'v') region =
"GB";
248 if (
c ==
'e') region =
"IL";
249 else if (
c ==
'i') region =
"IN";
250 else if (
c ==
'r') region =
"HT";
251 else if (
c ==
'u') region =
"HU";
254 if (
c ==
'd') region =
"ID";
255 else if (
c ==
's') region =
"IS";
256 else if (
c ==
't') region =
"IT";
257 else if (
c ==
'w') region =
"IL";
260 if (
c ==
'a') region =
"JP";
263 if (
c ==
'l') region =
"GL";
264 else if (
c ==
'o') region =
"KR";
265 else if (
c ==
'w') region =
"GB";
268 if (
c ==
't') region =
"LT";
269 else if (
c ==
'v') region =
"LV";
272 if (
c ==
'k') region =
"MK";
273 else if (
c ==
'l' ||
c ==
'r') region =
"IN";
274 else if (
c ==
'n') region =
"MN";
275 else if (
c ==
's') region =
"MY";
276 else if (
c ==
't') region =
"MT";
279 if (
c ==
'b' ||
c ==
'n' ||
c ==
'o') region =
"NO";
280 else if (
c ==
'e') region =
"NP";
281 else if (
c ==
'l') region =
"NL";
284 if (
c ==
'm') region =
"ET";
287 if (
c ==
'a') region =
"IN";
288 else if (
c ==
'l') region =
"PL";
289 else if (
c ==
't') region =
"PT";
292 if (
c ==
'o') region =
"RO";
293 else if (
c ==
'u') region =
"RU";
297 case 'e': region =
"NO";
break;
298 case 'h': region =
"YU";
break;
299 case 'k': region =
"SK";
break;
300 case 'l': region =
"SI";
break;
301 case 'o': region =
"ET";
break;
302 case 'q': region =
"AL";
break;
303 case 't': region =
"ZA";
break;
304 case 'v': region =
"SE";
break;
308 if (
c ==
'a' ||
c ==
'e') region =
"IN";
309 else if (
c ==
'h') region =
"TH";
310 else if (
c ==
'i') region =
"ER";
311 else if (
c ==
'r') region =
"TR";
312 else if (
c ==
't') region =
"RU";
315 if (
c ==
'k') region =
"UA";
316 else if (
c ==
'r') region =
"PK";
319 if (
c ==
'i') region =
"VN";
322 if (
c ==
'a') region =
"BE";
325 if (
c ==
'h') region =
"ZA";
328 if (
c ==
'h') region =
"CN";
329 else if (
c ==
'u') region =
"ZA";
343#ifdef XSLT_LOCALE_POSIX
362#ifdef XSLT_LOCALE_NONE
368#ifdef XSLT_LOCALE_POSIX
369 xstrlen = strxfrm_l(
NULL, (
const char *)
string, 0,
locale) + 1;
373 "xsltStrxfrm : out of memory error\n");
377 r = strxfrm_l((
char *)xstr, (
const char *)
string, xstrlen,
locale);
380#ifdef XSLT_LOCALE_WINAPI
425#ifdef XSLT_LOCALE_WINAPI
428 if (str1 == str2)
return(0);
429 if (str1 ==
NULL)
return(-1);
430 if (str2 ==
NULL)
return(1);
443#ifdef XSLT_LOCALE_WINAPI
453xsltCountSupportedLocales(
LPSTR lcid) {
455 ++xsltLocaleListSize;
468xsltIterateSupportedLocales(
LPSTR lcid) {
469 static int count = 0;
473 xsltRFC1766Info *
p = xsltLocaleList +
count;
475 k =
sscanf(lcid,
"%lx", (
long*)&
p->lcid);
479 (
char *) iso639lang,
sizeof(iso639lang));
480 if (--
k < 1)
goto end;
482 (
char *) iso3136ctry,
sizeof(iso3136ctry));
483 if (--
l < 1)
goto end;
501xsltEnumSupportedLocales(
void) {
503 if (xsltLocaleListSize <= 0) {
508 len = xsltLocaleListSize *
sizeof(xsltRFC1766Info);
char * strcpy(char *DstString, const char *SrcString)
#define MultiByteToWideChar
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
INT WINAPI GetLocaleInfoA(LCID lcid, LCTYPE lctype, LPSTR buffer, INT len)
BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA lpfnLocaleEnum, DWORD dwFlags)
GLuint GLuint GLsizei count
GLdouble GLdouble GLdouble r
GLdouble GLdouble GLdouble GLdouble q
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
#define memcpy(s1, s2, n)
XMLPUBVAR xmlMallocFunc xmlMalloc
XMLPUBVAR xmlFreeFunc xmlFree
XMLPUBFUN void XMLCALL xmlRMutexLock(xmlRMutexPtr tok)
XMLPUBFUN void XMLCALL xmlRMutexUnlock(xmlRMutexPtr tok)
#define LOCALE_SISO639LANGNAME
#define LOCALE_SISO3166CTRYNAME
XMLPUBFUN int XMLCALL xmlStrcmp(const xmlChar *str1, const xmlChar *str2)
void xsltFreeLocales(void)
static const xmlChar * xsltDefaultRegion(const xmlChar *localeName)
#define XSLTMAX_LANGTAGLEN
xsltLocaleChar * xsltStrxfrm(xsltLocale locale, const xmlChar *string)
#define XSLTMAX_ISO3166CNTRYLEN
#define XSLTMAX_ISO639LANGLEN
void xsltFreeLocale(xsltLocale locale)
xsltLocale xsltNewLocale(const xmlChar *languageTag)
int xsltLocaleStrcmp(xsltLocale locale, const xsltLocaleChar *str1, const xsltLocaleChar *str2)
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)