ReactOS 0.4.16-dev-122-g325d74c
c_locale_win32.c File Reference
#include <limits.h>
#include <string.h>
#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
#include "c_wlocale_win32.c"
Include dependency graph for c_locale_win32.c:

Go to the source code of this file.

Classes

struct  _LOCALECONV
 
struct  _Locale_name_hint
 
struct  _Locale_ctype
 
struct  _Locale_numeric
 
struct  _Locale_time
 
struct  _Locale_collate
 
struct  _Locale_monetary
 

Macros

#define _STLP_STRCPY(D, DS, S)   strcpy(D, S)
 
#define _STLP_STRNCPY(D, DS, S, C)   strncpy(D, S, C)
 
#define _STLP_STRCAT(D, DS, S)   strcat(D, S)
 
#define MAX_LANG_LEN   64 /* max language name length */
 
#define MAX_CTRY_LEN   64 /* max country name length */
 
#define MAX_MODIFIER_LEN   0 /* max modifier name length - n/a */
 
#define MAX_LC_LEN   (MAX_LANG_LEN+MAX_CTRY_LEN+MAX_MODIFIER_LEN+3)
 
#define MAX_CP_LEN   5 /* max code page name length */
 
#define LANG_INVARIANT   0x7f
 
#define _STLP_LANG_INVARIANT_DEFINED
 
#define CP_UTF7   65000
 
#define CP_UTF8   65001
 
#define INVARIANT_LCID   MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT)
 
#define MAP(x, y)   if ((mask & x) != 0) ret |= (y)
 
#define CSTR_EQUAL   2
 
#define CSTR_LESS_THAN   1
 

Typedefs

typedef struct _LOCALECONV LOCALECONV
 
typedef struct _Locale_name_hint _Locale_lcid_t
 
typedef struct _Locale_ctype _Locale_ctype_t
 
typedef struct _Locale_numeric _Locale_numeric_t
 
typedef struct _Locale_time _Locale_time_t
 
typedef struct _Locale_collate _Locale_collate_t
 
typedef struct _Locale_monetary _Locale_monetary_t
 

Functions

static void __FixGrouping (char *grouping)
 
static const char__ConvertName (const char *lname, LOCALECONV *ConvTable, int TableSize)
 
static int __ParseLocaleString (const char *lname, char *lang, char *ctry, char *page)
 
static int __GetLCID (const char *lang, const char *ctry, LCID *lcid)
 
static int __GetLCIDFromName (const char *lname, LCID *lcid, char *cp, _Locale_lcid_t *hint)
 
static char const__GetLocaleName (LCID lcid, const char *cp, char *buf)
 
static char const__Extract_locale_name (const char *loc, const char *category, char *buf)
 
static char const__TranslateToSystem (const char *lname, char *buf, _Locale_lcid_t *hint, int *__err_code)
 
static void __GetLocaleInfoUsingACP (LCID lcid, const char *cp, LCTYPE lctype, char *buf, int buf_size, wchar_t *wbuf, int wbuf_size)
 
static int __intGetACP (LCID lcid)
 
static int __intGetOCP (LCID lcid)
 
static int __GetDefaultCP (LCID lcid)
 
static char__ConvertToCP (int from_cp, int to_cp, const char *from, size_t size, size_t *ret_buf_size)
 
static void my_ltoa (long __x, char *buf)
 
_Locale_lcid_t_Locale_get_ctype_hint (_Locale_ctype_t *ltype)
 
_Locale_lcid_t_Locale_get_numeric_hint (_Locale_numeric_t *lnumeric)
 
_Locale_lcid_t_Locale_get_time_hint (_Locale_time_t *ltime)
 
_Locale_lcid_t_Locale_get_collate_hint (_Locale_collate_t *lcollate)
 
_Locale_lcid_t_Locale_get_monetary_hint (_Locale_monetary_t *lmonetary)
 
_Locale_lcid_t_Locale_get_messages_hint (struct _Locale_messages *lmessages)
 
unsigned short MapCtypeMask (unsigned short mask)
 
static void MapCtypeMasks (unsigned short *cur, unsigned short *end)
 
_Locale_ctype_t_Locale_ctype_create (const char *name, _Locale_lcid_t *lc_hint, int *__err_code)
 
_Locale_numeric_t_Locale_numeric_create (const char *name, _Locale_lcid_t *lc_hint, int *__err_code)
 
static int __ConvertDate (const char *NTDate, char *buffer, int buf_size)
 
static int __ConvertTime (const char *NTTime, char *buffer, int buf_size)
 
_Locale_time_t_Locale_time_create (const char *name, _Locale_lcid_t *lc_hint, int *__err_code)
 
_Locale_collate_t_Locale_collate_create (const char *name, _Locale_lcid_t *lc_hint, int *__err_code)
 
_Locale_monetary_t_Locale_monetary_create (const char *name, _Locale_lcid_t *lc_hint, int *__err_code)
 
struct _Locale_messages * _Locale_messages_create (const char *name, _Locale_lcid_t *lc_hint, int *__err_code)
 
static const char_Locale_common_default (char *buf)
 
const char_Locale_ctype_default (char *buf)
 
const char_Locale_numeric_default (char *buf)
 
const char_Locale_time_default (char *buf)
 
const char_Locale_collate_default (char *buf)
 
const char_Locale_monetary_default (char *buf)
 
const char_Locale_messages_default (char *buf)
 
char const_Locale_ctype_name (const _Locale_ctype_t *ltype, char *buf)
 
char const_Locale_numeric_name (const _Locale_numeric_t *lnum, char *buf)
 
char const_Locale_time_name (const _Locale_time_t *ltime, char *buf)
 
char const_Locale_collate_name (const _Locale_collate_t *lcol, char *buf)
 
char const_Locale_monetary_name (const _Locale_monetary_t *lmon, char *buf)
 
char const_Locale_messages_name (const struct _Locale_messages *lmes, char *buf)
 
void _Locale_ctype_destroy (_Locale_ctype_t *ltype)
 
void _Locale_numeric_destroy (_Locale_numeric_t *lnum)
 
void _Locale_time_destroy (_Locale_time_t *ltime)
 
void _Locale_collate_destroy (_Locale_collate_t *lcol)
 
void _Locale_monetary_destroy (_Locale_monetary_t *lmon)
 
void _Locale_messages_destroy (struct _Locale_messages *lmes)
 
static char const_Locale_extract_category_name (const char *name, const char *category, char *buf, _Locale_lcid_t *hint, int *__err_code)
 
char const_Locale_extract_ctype_name (const char *cname, char *buf, _Locale_lcid_t *hint, int *__err_code)
 
char const_Locale_extract_numeric_name (const char *cname, char *buf, _Locale_lcid_t *hint, int *__err_code)
 
char const_Locale_extract_time_name (const char *cname, char *buf, _Locale_lcid_t *hint, int *__err_code)
 
char const_Locale_extract_collate_name (const char *cname, char *buf, _Locale_lcid_t *hint, int *__err_code)
 
char const_Locale_extract_monetary_name (const char *cname, char *buf, _Locale_lcid_t *hint, int *__err_code)
 
char const_Locale_extract_messages_name (const char *cname, char *buf, _Locale_lcid_t *hint, int *__err_code)
 
const _Locale_mask_t_Locale_ctype_table (_Locale_ctype_t *ltype)
 
int _Locale_toupper (_Locale_ctype_t *ltype, int c)
 
int _Locale_tolower (_Locale_ctype_t *ltype, int c)
 
static DWORD trim_size_t_to_DWORD (size_t n)
 
static int _Locale_strcmp_auxA (_Locale_collate_t *lcol, const char *s1, size_t n1, const char *s2, size_t n2)
 
int _Locale_strcmp (_Locale_collate_t *lcol, const char *s1, size_t n1, const char *s2, size_t n2)
 
size_t _Locale_strxfrm (_Locale_collate_t *lcol, char *dst, size_t dst_size, const char *src, size_t src_size)
 
char _Locale_decimal_point (_Locale_numeric_t *lnum)
 
char _Locale_thousands_sep (_Locale_numeric_t *lnum)
 
const char_Locale_grouping (_Locale_numeric_t *lnum)
 
const char_Locale_true (_Locale_numeric_t *lnum)
 
const char_Locale_false (_Locale_numeric_t *lnum)
 
const char_Locale_int_curr_symbol (_Locale_monetary_t *lmon)
 
const char_Locale_currency_symbol (_Locale_monetary_t *lmon)
 
char _Locale_mon_decimal_point (_Locale_monetary_t *lmon)
 
char _Locale_mon_thousands_sep (_Locale_monetary_t *lmon)
 
const char_Locale_mon_grouping (_Locale_monetary_t *lmon)
 
const char_Locale_positive_sign (_Locale_monetary_t *lmon)
 
const char_Locale_negative_sign (_Locale_monetary_t *lmon)
 
char _Locale_int_frac_digits (_Locale_monetary_t *lmon)
 
char _Locale_frac_digits (_Locale_monetary_t *lmon)
 
int _Locale_p_cs_precedes (_Locale_monetary_t *lmon)
 
int _Locale_p_sep_by_space (_Locale_monetary_t *lmon)
 
int _Locale_p_sign_posn (_Locale_monetary_t *lmon)
 
int _Locale_n_cs_precedes (_Locale_monetary_t *lmon)
 
int _Locale_n_sep_by_space (_Locale_monetary_t *lmon)
 
int _Locale_n_sign_posn (_Locale_monetary_t *lmon)
 
const char_Locale_full_monthname (_Locale_time_t *ltime, int month)
 
const char_Locale_abbrev_monthname (_Locale_time_t *ltime, int month)
 
const char_Locale_full_dayofweek (_Locale_time_t *ltime, int day)
 
const char_Locale_abbrev_dayofweek (_Locale_time_t *ltime, int day)
 
const char_Locale_d_t_fmt (_Locale_time_t *ltime)
 
const char_Locale_long_d_t_fmt (_Locale_time_t *ltime)
 
const char_Locale_d_fmt (_Locale_time_t *ltime)
 
const char_Locale_long_d_fmt (_Locale_time_t *ltime)
 
const char_Locale_t_fmt (_Locale_time_t *ltime)
 
const char_Locale_am_str (_Locale_time_t *ltime)
 
const char_Locale_pm_str (_Locale_time_t *ltime)
 
nl_catd_type _Locale_catopen (struct _Locale_messages *lmes, const char *cat_name)
 
void _Locale_catclose (struct _Locale_messages *lmes, nl_catd_type cat)
 
const char_Locale_catgets (struct _Locale_messages *lmes, nl_catd_type cat, int setid, int msgid, const char *dfault)
 
void _Locale_init ()
 
void _Locale_final ()
 
static LCID LocaleFromHex (const char *locale)
 
static BOOL CALLBACK EnumLocalesProcA (LPSTR locale)
 
static int trim_size_t_to_int (size_t n)
 

Variables

static const char_C_name = "C"
 
static LOCALECONV __rg_language []
 
static LOCALECONV __rg_country []
 
static DWORD max_DWORD = 0xffffffff
 
static const char__true_name = "true"
 
static const char__false_name = "false"
 
static CRITICAL_SECTION __criticalSection
 
static int __FindFlag
 
static LCID __FndLCID
 
static const char__FndLang
 
static const char__FndCtry
 

Macro Definition Documentation

◆ _STLP_LANG_INVARIANT_DEFINED

#define _STLP_LANG_INVARIANT_DEFINED

Definition at line 68 of file c_locale_win32.c.

◆ _STLP_STRCAT

#define _STLP_STRCAT (   D,
  DS,
  S 
)    strcat(D, S)

Definition at line 38 of file c_locale_win32.c.

◆ _STLP_STRCPY

#define _STLP_STRCPY (   D,
  DS,
  S 
)    strcpy(D, S)

Definition at line 36 of file c_locale_win32.c.

◆ _STLP_STRNCPY

#define _STLP_STRNCPY (   D,
  DS,
  S,
  C 
)    strncpy(D, S, C)

Definition at line 37 of file c_locale_win32.c.

◆ CP_UTF7

#define CP_UTF7   65000

Definition at line 72 of file c_locale_win32.c.

◆ CP_UTF8

#define CP_UTF8   65001

Definition at line 76 of file c_locale_win32.c.

◆ CSTR_EQUAL

#define CSTR_EQUAL   2

Definition at line 1076 of file c_locale_win32.c.

◆ CSTR_LESS_THAN

#define CSTR_LESS_THAN   1

Definition at line 1079 of file c_locale_win32.c.

◆ INVARIANT_LCID

Definition at line 79 of file c_locale_win32.c.

◆ LANG_INVARIANT

#define LANG_INVARIANT   0x7f

Definition at line 67 of file c_locale_win32.c.

◆ MAP

#define MAP (   x,
  y 
)    if ((mask & x) != 0) ret |= (y)

Definition at line 283 of file c_locale_win32.c.

◆ MAX_CP_LEN

#define MAX_CP_LEN   5 /* max code page name length */

Definition at line 64 of file c_locale_win32.c.

◆ MAX_CTRY_LEN

#define MAX_CTRY_LEN   64 /* max country name length */

Definition at line 60 of file c_locale_win32.c.

◆ MAX_LANG_LEN

#define MAX_LANG_LEN   64 /* max language name length */

Definition at line 59 of file c_locale_win32.c.

◆ MAX_LC_LEN

Definition at line 62 of file c_locale_win32.c.

◆ MAX_MODIFIER_LEN

#define MAX_MODIFIER_LEN   0 /* max modifier name length - n/a */

Definition at line 61 of file c_locale_win32.c.

Typedef Documentation

◆ _Locale_collate_t

◆ _Locale_ctype_t

◆ _Locale_lcid_t

◆ _Locale_monetary_t

◆ _Locale_numeric_t

◆ _Locale_time_t

◆ LOCALECONV

Function Documentation

◆ __ConvertDate()

static int __ConvertDate ( const char NTDate,
char buffer,
int  buf_size 
)
static

Definition at line 427 of file c_locale_win32.c.

427 {
428 /* This function will return an incomplete buffer if buffer is not long enough */
429 const char *cur_char;
430 char *cur_output, *end_output;
431
432 /* Correct time format. */
433 cur_char = NTDate;
434 cur_output = buffer;
435 end_output = cur_output + buf_size;
436 buf_size = 0;
437 while (*cur_char) {
438 if (cur_output && (cur_output == end_output)) break;
439 switch (*cur_char) {
440 case 'd':
441 {
442 if (*(cur_char + 1) == 'd') {
443 if (cur_output && (cur_output + 2 > end_output)) {
444 *cur_output = 0;
445 return ++buf_size;
446 }
447 if (*(cur_char + 2) == 'd') {
448 if (*(cur_char + 3) == 'd') {
449 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'A'; }
450 buf_size += 2;
451 cur_char += 3;
452 }
453 else {
454 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'a'; }
455 buf_size += 2;
456 cur_char += 2;
457 }
458 }
459 else {
460 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'd'; }
461 buf_size += 2;
462 cur_char++;
463 }
464 }
465 else {
466 if (cur_output && (cur_output + 3 > end_output)) {
467 *cur_output = 0;
468 return ++buf_size;
469 }
470 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'd'; }
471 buf_size += 3;
472 }
473 }
474 break;
475 case 'M':
476 {
477 if (*(cur_char + 1) == 'M') {
478 if (cur_output && (cur_output + 2 > end_output)) {
479 *cur_output = 0;
480 return ++buf_size;
481 }
482 if (*(cur_char + 2) == 'M') {
483 if (*(cur_char + 3) == 'M') {
484 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'B'; }
485 buf_size += 2;
486 cur_char += 3;
487 }
488 else {
489 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'b'; }
490 buf_size += 2;
491 cur_char += 2;
492 }
493 }
494 else {
495 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'm'; }
496 buf_size += 2;
497 cur_char++;
498 }
499 }
500 else {
501 if (cur_output && (cur_output + 3 > end_output)) {
502 *cur_output = 0;
503 return ++buf_size;
504 }
505 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'm'; }
506 buf_size += 3;
507 }
508 }
509 break;
510 case 'y':
511 {
512 if (*(cur_char + 1) == 'y') {
513 if (cur_output && (cur_output + 2 > end_output)) {
514 *cur_output = 0;
515 return ++buf_size;
516 }
517 if (*(cur_char + 2) == 'y' && *(cur_char + 3) == 'y') {
518 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'Y'; }
519 buf_size += 2;
520 cur_char += 3;
521 }
522 else {
523 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'y'; }
524 buf_size += 2;
525 cur_char++;
526 }
527 }
528 else {
529 if (cur_output && (cur_output + 3 > end_output)) {
530 *cur_output = 0;
531 return ++buf_size;
532 }
533 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'y'; }
534 buf_size += 3;
535 }
536 }
537 break;
538 case '%':
539 {
540 if (cur_output && (cur_output + 2 > end_output)) {
541 *cur_output = 0;
542 return ++buf_size;
543 }
544 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '%'; }
545 buf_size += 2;
546 }
547 break;
548 case '\'':
549 {
550 ++cur_char;
551 while (*cur_char != '\'' && *cur_char != 0 && (cur_output == NULL || cur_output != end_output)) {
552 if (cur_output) { *cur_output++ = *cur_char; }
553 ++cur_char;
554 buf_size += 1;
555 }
556 }
557 break;
558 default:
559 {
560 if (cur_output) { *(cur_output++) = *cur_char; }
561 buf_size += 1;
562 }
563 break;
564 }
565 if (*cur_char == 0) break;
566 ++cur_char;
567 }
568
569 if (!cur_output || cur_output != end_output) {
570 if (cur_output) *cur_output = 0;
571 buf_size += 1;
572 }
573 else {
574 /* We trunc result */
575 *(--cur_output) = 0;
576 }
577
578 return buf_size;
579}
#define NULL
Definition: types.h:112
GLuint buffer
Definition: glext.h:5915

Referenced by _Locale_time_create().

◆ __ConvertName()

const char * __ConvertName ( const char lname,
LOCALECONV ConvTable,
int  TableSize 
)
static

Definition at line 1369 of file c_locale_win32.c.

1369 {
1370 int i;
1371 int cmp;
1372 int low = 0;
1373 int high = TableSize - 1;
1374
1375 /* typical binary search - do until no more to search or match */
1376 while (low <= high) {
1377 i = (low + high) / 2;
1378
1379 if ((cmp = lstrcmpiA(lname, (*(ConvTable + i)).name)) == 0)
1380 return (*(ConvTable + i)).abbrev;
1381 else if (cmp < 0)
1382 high = i - 1;
1383 else
1384 low = i + 1;
1385 }
1386 return lname;
1387}
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4223
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
Definition: glfuncs.h:248
#define cmp(status, error)
Definition: error.c:114
Definition: name.c:39
_Must_inspect_result_ typedef _Out_ PULONG TableSize
Definition: iotypes.h:4327

Referenced by __GetLCIDFromName().

◆ __ConvertTime()

static int __ConvertTime ( const char NTTime,
char buffer,
int  buf_size 
)
static

Definition at line 581 of file c_locale_win32.c.

581 {
582 const char *cur_char;
583 char *cur_output, *end_output;
584 cur_char = NTTime;
585 cur_output = buffer;
586 end_output = cur_output + buf_size;
587 buf_size = 0;
588 while (*cur_char) {
589 switch(*cur_char) {
590 case 'h':
591 if (*(cur_char + 1) == 'h') {
592 if (cur_output && (cur_output + 2 > end_output)) {
593 *cur_output = 0;
594 return ++buf_size;
595 }
596 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'I'; }
597 buf_size += 2;
598 ++cur_char;
599 }
600 else {
601 if (cur_output && (cur_output + 3 > end_output)) {
602 *cur_output = 0;
603 return ++buf_size;
604 }
605 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'I'; }
606 buf_size += 3;
607 }
608 break;
609 case 'H':
610 if (*(cur_char + 1) == 'H') {
611 if (cur_output && (cur_output + 2 > end_output)) {
612 *cur_output = 0;
613 return ++buf_size;
614 }
615 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'H'; }
616 buf_size += 2;
617 ++cur_char;
618 }
619 else {
620 if (cur_output && (cur_output + 3 > end_output)) {
621 *cur_output = 0;
622 return ++buf_size;
623 }
624 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'H'; }
625 buf_size += 3;
626 }
627 break;
628 case 'm':
629 if (*(cur_char + 1) == 'm') {
630 if (cur_output && (cur_output + 2 > end_output)) {
631 *cur_output = 0;
632 return ++buf_size;
633 }
634 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'M'; }
635 buf_size += 2;
636 cur_char++;
637 }
638 else {
639 if (cur_output && (cur_output + 3 > end_output)) {
640 *cur_output = 0;
641 return ++buf_size;
642 }
643 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'M'; }
644 buf_size += 3;
645 }
646 break;
647 case 's':
648 if (*(cur_char + 1) == 's') {
649 if (cur_output && (cur_output + 2 > end_output)) {
650 *cur_output = 0;
651 return ++buf_size;
652 }
653 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'S'; }
654 buf_size += 2;
655 ++cur_char;
656 }
657 else {
658 if (cur_output && (cur_output + 3 > end_output)) {
659 *cur_output = 0;
660 return ++buf_size;
661 }
662 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'S'; }
663 buf_size += 3;
664 }
665 break;
666 case 't':
667 if (*(cur_char + 1) == 't')
668 ++cur_char;
669 if (cur_output && (cur_output + 2 > end_output)) {
670 *cur_output = 0;
671 return ++buf_size;
672 }
673 if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'p'; }
674 buf_size += 2;
675 break;
676 case '%':
677 if (cur_output && (cur_output + 2 > end_output)) {
678 *cur_output = 0;
679 return ++buf_size;
680 }
681 if (cur_output) { *(cur_output++)='%'; *(cur_output++)='%'; }
682 buf_size += 2;
683 break;
684 case '\'':
685 ++cur_char;
686 while (*cur_char != '\'' && *cur_char != 0 && (!cur_output || (cur_output != end_output))) {
687 if (cur_output) *cur_output++ = *cur_char;
688 ++cur_char;
689 buf_size += 1;
690 }
691 break;
692 default:
693 if (cur_output) { *(cur_output++) = *cur_char; }
694 buf_size += 1;
695 break;
696 }
697 if (*cur_char == 0) break;
698 ++cur_char;
699 }
700
701 if (!cur_output || cur_output != end_output) {
702 if (cur_output) *cur_output = 0;
703 buf_size += 1;
704 }
705 else {
706 /* We trunc result */
707 *(--cur_output) = 0;
708 }
709
710 return buf_size;
711}

Referenced by _Locale_time_create().

◆ __ConvertToCP()

char * __ConvertToCP ( int  from_cp,
int  to_cp,
const char from,
size_t  size,
size_t ret_buf_size 
)
static

Definition at line 1717 of file c_locale_win32.c.

1717 {
1718 size_t wbuffer_size, buffer_size, from_offset, wbuf_offset;
1719 int from_size, to_size, wbuf_size;
1720 wchar_t *wbuffer;
1721 char* buffer;
1722
1723 size_t orig_size = size;
1724
1725 wbuffer_size = 0;
1726 from_offset = 0;
1727 while (size > 0) {
1728 from_size = trim_size_t_to_int(size);
1729 wbuffer_size += MultiByteToWideChar(from_cp, MB_PRECOMPOSED,
1730 from + from_offset, from_size, NULL, 0);
1731 from_offset += from_size;
1732 size -= from_size;
1733 }
1734
1735 wbuffer = (wchar_t*)malloc(sizeof(wchar_t)*wbuffer_size);
1736
1737 size = orig_size;
1738 wbuf_offset = 0;
1739 from_offset = 0;
1740 while (size > 0) {
1741 from_size = trim_size_t_to_int(size);
1742 wbuf_size = trim_size_t_to_int(wbuffer_size - wbuf_offset);
1743 wbuf_offset += MultiByteToWideChar(from_cp, MB_PRECOMPOSED,
1744 from + from_offset, from_size, wbuffer + wbuf_offset, wbuf_size);
1745 from_offset += from_size;
1746 size -= from_size;
1747 }
1748
1749 buffer_size = 0;
1750 wbuf_offset = 0;
1751 size = wbuffer_size;
1752 while (size > 0) {
1753 wbuf_size = trim_size_t_to_int(size);
1755 wbuffer + wbuf_offset, wbuf_size,
1756 NULL, 0, NULL, FALSE);
1757 wbuf_offset += wbuf_size;
1758 size -= wbuf_size;
1759 }
1760
1761 buffer = (char*)malloc(buffer_size);
1762 *ret_buf_size = buffer_size;
1763
1764 size = wbuffer_size;
1765 wbuf_offset = 0;
1766 while (size > 0) {
1767 wbuf_size = trim_size_t_to_int(size);
1770 wbuffer + wbuf_offset, wbuf_size,
1771 buffer, to_size, NULL, FALSE);
1772 wbuf_offset += wbuf_size;
1773 size -= wbuf_size;
1774 }
1775
1776 free(wbuffer);
1777 return buffer;
1778}
static int trim_size_t_to_int(size_t n)
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define FALSE
Definition: types.h:117
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
GLsizeiptr size
Definition: glext.h:5919
#define WC_COMPOSITECHECK
Definition: unicode.h:43
CardRegion * from
Definition: spigame.cpp:19
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:888
#define WC_SEPCHARS
Definition: winnls.h:219
#define MB_PRECOMPOSED
Definition: winnls.h:281

Referenced by _Locale_strcmp(), and _Locale_strxfrm().

◆ __Extract_locale_name()

char const * __Extract_locale_name ( const char loc,
const char category,
char buf 
)
static

Definition at line 1628 of file c_locale_win32.c.

1628 {
1629 char *expr;
1630 size_t len_name;
1631
1632 if (loc[0] == 'L' && loc[1] == 'C' && loc[2] == '_') {
1633 expr = strstr((char*)loc, category);
1634 if (expr == NULL) return NULL; /* Category not found. */
1635 expr = strchr(expr, '=');
1636 if (expr == NULL) return NULL;
1637 ++expr;
1638 len_name = strcspn(expr, ";");
1639 len_name = len_name >= _Locale_MAX_SIMPLE_NAME ? _Locale_MAX_SIMPLE_NAME - 1
1640 : len_name;
1641 _STLP_STRNCPY(buf, _Locale_MAX_SIMPLE_NAME, expr, len_name); buf[len_name] = 0;
1642 return buf;
1643 }
1644 else {
1645 return loc;
1646 }
1647}
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define _STLP_STRNCPY(D, DS, S, C)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define _Locale_MAX_SIMPLE_NAME
Definition: c_locale.h:54
_Check_return_ _CRTIMP size_t __cdecl strcspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
Definition: query.h:86

Referenced by _Locale_extract_category_name().

◆ __FixGrouping()

void __FixGrouping ( char grouping)
static

Definition at line 1329 of file c_locale_win32.c.

1329 {
1330 /* This converts NT version which uses '0' instead of 0, etc ; to ANSI */
1331 char *g = grouping;
1332 char building_group = 0;
1333 char repeat_last = 0;
1334 /* Check there is a grouping info otherwise we would add a useless CHAR_MAX */
1335 if (*g) {
1336 for (; *g; ++g) {
1337 if (*g > '0' && *g <= '9') {
1338 if (!building_group) {
1339 *grouping = *g - '0';
1340 building_group = 1;
1341 }
1342 else {
1343 /* Known issue: grouping might roll. */
1344 *grouping = *grouping * 10 + *g - '0';
1345 }
1346 }
1347 else if (*g == '0') {
1348 if (!building_group) {
1349 repeat_last = 1;
1350 }
1351 else
1352 /* Known issue: grouping might roll. */
1353 *grouping *= 10;
1354 }
1355 else if (*g == ';') {
1356 /* Stop adding to the current group */
1357 building_group = 0;
1358 ++grouping;
1359 }
1360 /* else we ignore the character */
1361 }
1362
1363 if (!repeat_last)
1364 *grouping++ = CHAR_MAX;
1365 *grouping = 0;
1366 }
1367}
GLboolean GLboolean g
Definition: glext.h:6204
#define CHAR_MAX
Definition: limits.h:32

Referenced by _Locale_monetary_create(), and _Locale_numeric_create().

◆ __GetDefaultCP()

int __GetDefaultCP ( LCID  lcid)
static

Definition at line 1709 of file c_locale_win32.c.

1709 {
1710 int cp = __intGetACP(lcid);
1711 if (cp == 0) return __intGetOCP(lcid);
1712 else return cp;
1713}
static int __intGetOCP(LCID lcid)
static int __intGetACP(LCID lcid)
POINT cp
Definition: magnifier.c:59

Referenced by _Locale_common_default(), _Locale_ctype_create(), _Locale_strcmp(), _Locale_strxfrm(), _Locale_tolower(), and _Locale_toupper().

◆ __GetLCID()

int __GetLCID ( const char lang,
const char ctry,
LCID lcid 
)
static

Definition at line 1523 of file c_locale_win32.c.

1523 {
1524 int ret;
1526
1527 __FindFlag = 0;
1528 __FndLang = lang;
1529 __FndCtry = ctry;
1531
1532 if (__FindFlag != 0) *lcid = __FndLCID;
1533 ret = __FindFlag != 0 ? 0 : -1;
1534
1536 return ret;
1537}
static const char * __FndCtry
static const char * __FndLang
static LCID __FndLCID
static BOOL CALLBACK EnumLocalesProcA(LPSTR locale)
static CRITICAL_SECTION __criticalSection
static int __FindFlag
BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA lpfnLocaleEnum, DWORD dwFlags)
Definition: locale.c:2983
static const WCHAR lang[]
Definition: wbemdisp.c:287
int ret
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LCID_INSTALLED
Definition: winnls.h:201

Referenced by __GetLCIDFromName().

◆ __GetLCIDFromName()

int __GetLCIDFromName ( const char lname,
LCID lcid,
char cp,
_Locale_lcid_t hint 
)
static

Definition at line 1539 of file c_locale_win32.c.

1539 {
1540 char lang[MAX_LANG_LEN + 1], ctry[MAX_CTRY_LEN + 1], page[MAX_CP_LEN + 1];
1541 int result = 0;
1542 if (lname == NULL || lname[0] == 0) {
1543 *lcid = LOCALE_USER_DEFAULT;
1544 return 0;
1545 }
1546
1547 memset(lang, 0, MAX_LANG_LEN + 1);
1548 memset(ctry, 0, MAX_CTRY_LEN + 1);
1549 memset(page, 0, MAX_CP_LEN + 1);
1550 if (__ParseLocaleString(lname, lang, ctry, page) == -1) return -1;
1551
1552 if (hint != 0) {
1553 *lcid = hint->id;
1554 }
1555 else {
1556 if (lang[0] == 0 && ctry[0] == 0)
1557 *lcid = LOCALE_USER_DEFAULT; /* Only code page given. */
1558 else {
1559 if (ctry[0] == 0) {
1561 if (result != 0) {
1562 /* Check 'C' special case. Check is done after call to __GetLCID because normal programs do not
1563 * generate facet from 'C' name, they use the locale::classic() facets. */
1564 if (lang[0] == 'C' && lang[1] == 0) {
1565 *lcid = INVARIANT_LCID;
1566 result = 0;
1567 }
1568 }
1569 }
1570 else {
1572 __ConvertName(ctry, __rg_country, sizeof(__rg_country) / sizeof(LOCALECONV)),
1573 lcid);
1574 if (result != 0) {
1575 /* Non NLS mapping might introduce problem with some locales when only one entry is mapped,
1576 * the lang or the country (example: chinese locales like 'chinese_taiwan' gives 'CHS_taiwan'
1577 * that do not exists in system). This is why we are giving this locale an other chance by
1578 * calling __GetLCID without the mapping. */
1579 result = __GetLCID(lang, ctry, lcid);
1580 }
1581 }
1582 }
1583 }
1584
1585 if (result == 0) {
1586 /* Handling code page */
1587 if (lstrcmpiA(page, "ACP") == 0 || page[0] == 0)
1588 my_ltoa(__intGetACP(*lcid), cp);
1589 else if (lstrcmpiA(page, "OCP") == 0)
1590 my_ltoa(__intGetOCP(*lcid), cp);
1591 else if (lstrcmpiA(page, "UTF7") == 0)
1592 my_ltoa(CP_UTF7, cp);
1593 else if (lstrcmpiA(page, "UTF8") == 0)
1594 my_ltoa(CP_UTF8, cp);
1595 else
1596 _STLP_STRNCPY(cp, MAX_CP_LEN + 1, page, 5);
1597
1598 /* Code page must be an integer value,
1599 * 0 returned by __intGetACP and 1 returned by __intGetOCP are invalid
1600 * values.
1601 */
1602 if (cp[1] == 0 && (cp[0] == '0' || cp[1] == '1'))
1603 return -1;
1604 else if (atoi(cp) == 0)
1605 return -1;
1606 }
1607
1608 return result;
1609}
static int __GetLCID(const char *lang, const char *ctry, LCID *lcid)
static void my_ltoa(long __x, char *buf)
#define MAX_LANG_LEN
static const char * __ConvertName(const char *lname, LOCALECONV *ConvTable, int TableSize)
#define INVARIANT_LCID
static LOCALECONV __rg_language[]
#define CP_UTF7
static int __ParseLocaleString(const char *lname, char *lang, char *ctry, char *page)
#define MAX_CP_LEN
#define CP_UTF8
#define MAX_CTRY_LEN
static LOCALECONV __rg_country[]
GLuint64EXT * result
Definition: glext.h:11304
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define LOCALE_USER_DEFAULT
#define memset(x, y, z)
Definition: compat.h:39
Definition: module.h:576
DWORD hint
Definition: vfdcmd.c:88

Referenced by __TranslateToSystem(), _Locale_codecvt_create(), _Locale_collate_create(), _Locale_ctype_create(), _Locale_monetary_create(), _Locale_numeric_create(), and _Locale_time_create().

◆ __GetLocaleInfoUsingACP()

void __GetLocaleInfoUsingACP ( LCID  lcid,
const char cp,
LCTYPE  lctype,
char buf,
int  buf_size,
wchar_t wbuf,
int  wbuf_size 
)
static

Definition at line 1659 of file c_locale_win32.c.

1659 {
1660 wchar_t *Buffer;
1661 int BufferSize;
1662 int icp;
1663
1664 GetLocaleInfoA(lcid, lctype, buf, buf_size);
1665
1666 icp = atoi(cp);
1667 if (icp != CP_ACP && buf[0] != 0) {
1669 if (BufferSize > wbuf_size)
1670 {
1671 Buffer = (wchar_t*)malloc(sizeof(wchar_t) * BufferSize);
1672 }
1673 else
1674 {
1675 Buffer = wbuf;
1676 }
1678 WideCharToMultiByte(icp, 0, Buffer, -1, buf, buf_size, NULL, NULL);
1679 if (Buffer != wbuf)
1680 {
1681 free(Buffer);
1682 }
1683 }
1684}
Definition: bufpool.h:45
#define BufferSize
Definition: mmc.h:75
#define CP_ACP
Definition: compat.h:109
INT WINAPI GetLocaleInfoA(LCID lcid, LCTYPE lctype, LPSTR buffer, INT len)
Definition: locale.c:1599
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254

Referenced by _Locale_monetary_create(), _Locale_numeric_create(), and _Locale_time_create().

◆ __GetLocaleName()

char const * __GetLocaleName ( LCID  lcid,
const char cp,
char buf 
)
static

Definition at line 1611 of file c_locale_win32.c.

1611 {
1612 if (lcid == INVARIANT_LCID) {
1613 return _C_name;
1614 }
1615 else {
1616 char lang[MAX_LANG_LEN + 1], ctry[MAX_CTRY_LEN + 1];
1624 return buf;
1625 }
1626}
#define _STLP_STRCPY(D, DS, S)
#define _STLP_STRCAT(D, DS, S)
static const char * _C_name
#define LOCALE_SENGLANGUAGE
Definition: winnls.h:27
#define LOCALE_SENGCOUNTRY
Definition: winnls.h:32

Referenced by __TranslateToSystem(), _Locale_codecvt_name(), _Locale_collate_name(), _Locale_common_default(), _Locale_ctype_name(), _Locale_monetary_name(), _Locale_numeric_name(), and _Locale_time_name().

◆ __intGetACP()

int __intGetACP ( LCID  lcid)
static

Definition at line 1687 of file c_locale_win32.c.

1687 {
1688 char cp[6];
1690#if defined (_STLP_LANG_INVARIANT_DEFINED)
1691 if (lcid == INVARIANT_LCID) {
1692 /* We are using a limited PSDK, we rely on the most common code page */
1693 return 1252;
1694 }
1695#endif
1696 return 0;
1697 }
1698 return atoi(cp);
1699}
#define LOCALE_IDEFAULTANSICODEPAGE
Definition: winnls.h:38

Referenced by __GetDefaultCP(), and __GetLCIDFromName().

◆ __intGetOCP()

int __intGetOCP ( LCID  lcid)
static

Definition at line 1702 of file c_locale_win32.c.

1702 {
1703 char cp[6];
1705 return 0;
1706 return atoi(cp);
1707}
#define LOCALE_IDEFAULTCODEPAGE
Definition: winnls.h:37

Referenced by __GetDefaultCP(), and __GetLCIDFromName().

◆ __ParseLocaleString()

int __ParseLocaleString ( const char lname,
char lang,
char ctry,
char page 
)
static

Definition at line 1389 of file c_locale_win32.c.

1390 {
1391 int param = 0;
1392 size_t len;
1393 size_t tmpLen;
1394
1395 if (lname[0] == 0)
1396 return 0;
1397
1398 /* We look for the first country separator '_' */
1399 len = strcspn(lname, "_");
1400 if (lname[len] == '_') {
1401 if (len == 0 || len > MAX_LANG_LEN) return -1; /* empty lang is invalid*/
1402 _STLP_STRNCPY(lang, MAX_LANG_LEN + 1, lname, len);
1403 lname += len + 1;
1404 ++param;
1405 }
1406
1407 /* We look for the last code page separator '.' */
1408 len = -1;
1409 tmpLen = strcspn(lname, ".");
1410 while (lname[tmpLen] == '.') {
1411 len = tmpLen; ++tmpLen;
1412 tmpLen += strcspn(lname + tmpLen, ".");
1413 }
1414 if (len != -1) { /* Means that we found a '.' */
1415 if (param == 0) {
1416 /* We have no lang yet so we have to fill it first, no country */
1417 if (len > MAX_LANG_LEN) return -1;
1418 if (len == 0) {
1419 /* No language nor country, only code page */
1420 ++param;
1421 }
1422 else
1423 { _STLP_STRNCPY(lang, MAX_LANG_LEN + 1, lname, len); }
1424 ++param;
1425 }
1426 else {
1427 /* We already have a lang so we are now looking for the country: */
1428 if (len == 0) return -1; /* We forbid locale name with the "_." motif in it */
1429 if (len > MAX_CTRY_LEN) return -1;
1430 _STLP_STRNCPY(ctry, MAX_CTRY_LEN + 1, lname, len);
1431 }
1432 ++param;
1433 lname += len + 1;
1434 }
1435
1436 /* We look for ',' for compatibility with POSIX */
1437 len = strcspn(lname, ",");
1438 switch (param) {
1439 case 0:
1440 if (len > MAX_LANG_LEN) return -1;
1441 _STLP_STRNCPY(lang, MAX_LANG_LEN + 1, lname, len);
1442 break;
1443 case 1:
1444 if (len > MAX_CTRY_LEN) return -1;
1445 _STLP_STRNCPY(ctry, MAX_CTRY_LEN + 1, lname, len);
1446 break;
1447 default:
1448 if (len > MAX_CP_LEN) return -1;
1449 _STLP_STRNCPY(page, MAX_CP_LEN + 1, lname, len);
1450 break;
1451 }
1452
1453 /* ',' POSIX modifier is not used in NT */
1454 return 0;
1455}
GLfloat param
Definition: glext.h:5796
GLenum GLsizei len
Definition: glext.h:6722

Referenced by __GetLCIDFromName().

◆ __TranslateToSystem()

char const * __TranslateToSystem ( const char lname,
char buf,
_Locale_lcid_t hint,
int __err_code 
)
static

Definition at line 1649 of file c_locale_win32.c.

1650 {
1651 LCID lcid;
1652 char cp[MAX_CP_LEN + 1];
1653 if (__GetLCIDFromName(lname, &lcid, cp, hint) != 0)
1654 { *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
1655
1656 return __GetLocaleName(lcid, cp, buf);
1657}
static int __GetLCIDFromName(const char *lname, LCID *lcid, char *cp, _Locale_lcid_t *hint)
static char const * __GetLocaleName(LCID lcid, const char *cp, char *buf)
#define _STLP_LOC_UNKNOWN_NAME
Definition: c_locale.h:101
DWORD LCID
Definition: nls.h:13

Referenced by _Locale_extract_category_name(), and _Locale_extract_messages_name().

◆ _Locale_abbrev_dayofweek()

const char * _Locale_abbrev_dayofweek ( _Locale_time_t ltime,
int  day 
)

Definition at line 1279 of file c_locale_win32.c.

1279 {
1280 const char **names = (const char**)ltime->abbrev_dayofweek;
1281 return names[day];
1282}
static DOUBLE day(DOUBLE time)
Definition: date.c:117
GLuint GLuint * names
Definition: glext.h:11545
char * abbrev_dayofweek[7]

Referenced by _Init_timeinfo().

◆ _Locale_abbrev_monthname()

const char * _Locale_abbrev_monthname ( _Locale_time_t ltime,
int  month 
)

Definition at line 1269 of file c_locale_win32.c.

1269 {
1270 const char **names = (const char**)ltime->abbrev_month;
1271 return names[month];
1272}
static const WCHAR month[12][4]
Definition: session.c:2150
char * abbrev_month[12]

Referenced by _Init_timeinfo().

◆ _Locale_am_str()

const char * _Locale_am_str ( _Locale_time_t ltime)

Definition at line 1299 of file c_locale_win32.c.

1300{ return ltime->am; }

Referenced by _Init_timeinfo().

◆ _Locale_catclose()

void _Locale_catclose ( struct _Locale_messages *  lmes,
nl_catd_type  cat 
)

Definition at line 1311 of file c_locale_win32.c.

1311 {
1314}
#define _STLP_MARK_PARAMETER_AS_UNUSED(X)
Definition: _dm.h:68

Referenced by _Messages::do_close().

◆ _Locale_catgets()

const char * _Locale_catgets ( struct _Locale_messages *  lmes,
nl_catd_type  cat,
int  setid,
int  msgid,
const char dfault 
)

Definition at line 1315 of file c_locale_win32.c.

1316 {
1321 return dfault;
1322}

Referenced by _Messages::do_get().

◆ _Locale_catopen()

nl_catd_type _Locale_catopen ( struct _Locale_messages *  lmes,
const char cat_name 
)

Definition at line 1306 of file c_locale_win32.c.

1306 {
1309 return -1;
1310}

Referenced by _Messages::do_open().

◆ _Locale_collate_create()

_Locale_collate_t * _Locale_collate_create ( const char name,
_Locale_lcid_t lc_hint,
int __err_code 
)

Definition at line 811 of file c_locale_win32.c.

811 {
813 if (!lcol) { *__err_code = _STLP_LOC_NO_MEMORY; return lcol; }
814 memset(lcol, 0, sizeof(_Locale_collate_t));
815
816 if (__GetLCIDFromName(name, &lcol->lc.id, lcol->cp, lc_hint) == -1)
817 { free(lcol); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
818
819#if defined (__BORLANDC__)
820 if ( lcol->lc.id == INVARIANT_LCID && name[0] == 'C' && name[1] == 0 )
821 { lcol->lc.id = 0x409; }
822#endif
823
824 return lcol;
825}
#define _STLP_LOC_NO_MEMORY
Definition: c_locale.h:103
char cp[MAX_CP_LEN+1]
_Locale_lcid_t lc

Referenced by _Loc_collate_create().

◆ _Locale_collate_default()

const char * _Locale_collate_default ( char buf)

Definition at line 903 of file c_locale_win32.c.

904{ return _Locale_common_default(buf); }
static const char * _Locale_common_default(char *buf)

Referenced by _Loc_collate_default(), and _Locale_impl::insert_collate_facets().

◆ _Locale_collate_destroy()

void _Locale_collate_destroy ( _Locale_collate_t lcol)

Definition at line 972 of file c_locale_win32.c.

972 {
973 if (!lcol) return;
974
975 free(lcol);
976}

Referenced by _Loc_collate_destroy().

◆ _Locale_collate_name()

char const * _Locale_collate_name ( const _Locale_collate_t lcol,
char buf 
)

Definition at line 924 of file c_locale_win32.c.

925{ return __GetLocaleName(lcol->lc.id, lcol->cp, buf); }

◆ _Locale_common_default()

static const char * _Locale_common_default ( char buf)
static

Definition at line 887 of file c_locale_win32.c.

887 {
888 char cp[MAX_CP_LEN + 1];
889 int CodePage = __GetDefaultCP(LOCALE_USER_DEFAULT);
890 my_ltoa(CodePage, cp);
892}
static int __GetDefaultCP(LCID lcid)

Referenced by _Locale_collate_default(), _Locale_ctype_default(), _Locale_messages_default(), _Locale_monetary_default(), _Locale_numeric_default(), and _Locale_time_default().

◆ _Locale_ctype_create()

_Locale_ctype_t * _Locale_ctype_create ( const char name,
_Locale_lcid_t lc_hint,
int __err_code 
)

Definition at line 304 of file c_locale_win32.c.

304 {
305 char cp_name[MAX_CP_LEN + 1];
306 int NativeCP;
307 unsigned char Buffer[256];
308 unsigned char *ptr;
309 CPINFO CPInfo;
310 int i;
311 wchar_t *wbuffer;
312 int BufferSize;
313
315
316 if (!ltype) { *__err_code = _STLP_LOC_NO_MEMORY; return ltype; }
317 memset(ltype, 0, sizeof(_Locale_ctype_t));
318
319 if (__GetLCIDFromName(name, &ltype->lc.id, cp_name, lc_hint) == -1)
320 { free(ltype); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
321
322#if defined (__BORLANDC__)
323 if ( ltype->lc.id == INVARIANT_LCID && name[0] == 'C' && name[1] == 0 )
324 { ltype->lc.id = 0x409; }
325#endif
326
327 ltype->cp = atoi(cp_name);
328
329 NativeCP = __GetDefaultCP(ltype->lc.id);
330
331 /* Make table with all characters. */
332 for (i = 0; i < 256; ++i) Buffer[i] = (unsigned char)i;
333
334 if (!GetCPInfo(NativeCP, &CPInfo)) { free(ltype); return NULL; }
335
336 if (CPInfo.MaxCharSize > 1) {
337 for (ptr = (unsigned char*)CPInfo.LeadByte; *ptr && *(ptr + 1); ptr+=2)
338 for (i = *ptr; i <= *(ptr + 1); ++i) Buffer[i] = 0;
339 }
340
341 if ((UINT)NativeCP != ltype->cp) {
342 OSVERSIONINFO ver_info;
343 ver_info.dwOSVersionInfoSize = sizeof(ver_info);
344 GetVersionEx(&ver_info);
345 if (ver_info.dwPlatformId == VER_PLATFORM_WIN32_NT) {
346 /* Convert character sequence to Unicode. */
347 BufferSize = MultiByteToWideChar(ltype->cp, MB_PRECOMPOSED, (const char*)Buffer, 256, NULL, 0);
348 if (!BufferSize) { free(ltype); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
349 wbuffer = (wchar_t*)malloc(BufferSize * sizeof(wchar_t));
350 if (!wbuffer) { free(ltype); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
351 MultiByteToWideChar(ltype->cp, MB_PRECOMPOSED, (const char*)Buffer, 256, wbuffer, BufferSize);
352
353 GetStringTypeW(CT_CTYPE1, wbuffer, 256, ltype->ctable);
354 MapCtypeMasks(ltype->ctable, ltype->ctable + 256);
355 free(wbuffer);
356 }
357 else {
358 unsigned short ctable[256];
359 unsigned char TargetBuffer[256];
360 GetStringTypeA(ltype->lc.id, CT_CTYPE1, (const char*)Buffer, 256, ctable);
361
362 /* Convert character sequence to target code page. */
363 BufferSize = MultiByteToWideChar(NativeCP, MB_PRECOMPOSED, (const char*)Buffer, 256, NULL, 0);
364 if (!BufferSize) { free(ltype); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
365 wbuffer = (wchar_t*)malloc(BufferSize * sizeof(wchar_t));
366 if (!wbuffer) { free(ltype); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
367 MultiByteToWideChar(NativeCP, MB_PRECOMPOSED, (const char*)Buffer, 256, wbuffer, BufferSize);
368 if (!WideCharToMultiByte(ltype->cp, WC_COMPOSITECHECK | WC_SEPCHARS, wbuffer, BufferSize, (char*)TargetBuffer, 256, NULL, FALSE))
369 { free(wbuffer); free(ltype); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
370
371 free(wbuffer);
372
373 /* Translate ctype table. */
374 for (i = 0; i < 256; ++i) {
375 if (!TargetBuffer[i]) continue;
376 ltype->ctable[TargetBuffer[i]] = MapCtypeMask(ctable[i]);
377 }
378 }
379 }
380 else {
381 GetStringTypeA(ltype->lc.id, CT_CTYPE1, (const char*)Buffer, 256, ltype->ctable);
382 MapCtypeMasks(ltype->ctable, ltype->ctable + 256);
383 }
384 return ltype;
385}
static _Locale_mask_t ctable[256]
unsigned short MapCtypeMask(unsigned short mask)
static void MapCtypeMasks(unsigned short *cur, unsigned short *end)
BOOL WINAPI GetStringTypeA(LCID locale, DWORD type, LPCSTR src, INT count, LPWORD chartype)
Definition: locale.c:3208
BOOL WINAPI GetCPInfo(UINT codepage, LPCPINFO cpinfo)
Definition: locale.c:2143
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: locale.c:3094
static PVOID ptr
Definition: dispmode.c:27
unsigned int UINT
Definition: ndis.h:50
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:238
unsigned short ctable[256]
_Locale_lcid_t lc
ULONG dwPlatformId
Definition: rtltypes.h:241
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
BYTE LeadByte[MAX_LEADBYTES]
Definition: winnls.h:583
UINT MaxCharSize
Definition: winnls.h:581
#define GetVersionEx
Definition: winbase.h:3852
#define CT_CTYPE1
Definition: winnls.h:237

Referenced by _Loc_ctype_create().

◆ _Locale_ctype_default()

const char * _Locale_ctype_default ( char buf)

Definition at line 894 of file c_locale_win32.c.

895{ return _Locale_common_default(buf); }

Referenced by _Loc_ctype_default(), and _Locale_impl::insert_ctype_facets().

◆ _Locale_ctype_destroy()

void _Locale_ctype_destroy ( _Locale_ctype_t ltype)

Definition at line 936 of file c_locale_win32.c.

936 {
937 if (!ltype) return;
938
939 free(ltype);
940}

Referenced by _Loc_ctype_destroy().

◆ _Locale_ctype_name()

char const * _Locale_ctype_name ( const _Locale_ctype_t ltype,
char buf 
)

Definition at line 912 of file c_locale_win32.c.

912 {
913 char cp_buf[MAX_CP_LEN + 1];
914 my_ltoa(ltype->cp, cp_buf);
915 return __GetLocaleName(ltype->lc.id, cp_buf, buf);
916}

◆ _Locale_ctype_table()

const _Locale_mask_t * _Locale_ctype_table ( _Locale_ctype_t ltype)

Definition at line 1030 of file c_locale_win32.c.

1030 {
1031 _STLP_STATIC_ASSERT(sizeof(_Locale_mask_t) == sizeof(ltype->ctable[0]))
1033}
return
Definition: dirsup.c:529
#define _STLP_STATIC_ASSERT(expr)
Definition: features.h:313
unsigned short int _Locale_mask_t
Definition: c_locale.h:63
#define const
Definition: zconf.h:233

Referenced by ctype_byname< char >::_M_init().

◆ _Locale_currency_symbol()

const char * _Locale_currency_symbol ( _Locale_monetary_t lmon)

Definition at line 1183 of file c_locale_win32.c.

1184{ return lmon->curr_symbol; }

Referenced by moneypunct_byname< char, false >::do_curr_symbol().

◆ _Locale_d_fmt()

const char * _Locale_d_fmt ( _Locale_time_t ltime)

Definition at line 1290 of file c_locale_win32.c.

1291{ return ltime->date_format; }
char * date_format

Referenced by __get_date_order(), and _Init_timeinfo_base().

◆ _Locale_d_t_fmt()

const char * _Locale_d_t_fmt ( _Locale_time_t ltime)

Definition at line 1284 of file c_locale_win32.c.

1285{ return ltime->date_time_format; }
char * date_time_format

Referenced by _Init_timeinfo_base().

◆ _Locale_decimal_point()

char _Locale_decimal_point ( _Locale_numeric_t lnum)

Definition at line 1158 of file c_locale_win32.c.

1159{ return lnum->decimal_point[0]; }

Referenced by numpunct_byname< char >::do_decimal_point().

◆ _Locale_extract_category_name()

static char const * _Locale_extract_category_name ( const char name,
const char category,
char buf,
_Locale_lcid_t hint,
int __err_code 
)
static

Definition at line 988 of file c_locale_win32.c.

989 {
990 const char* cname = __Extract_locale_name(name, category, buf);
991 if (cname == 0 || (cname[0] == 'C' && cname[1] == 0)) {
992 return cname;
993 }
994 return __TranslateToSystem(cname, buf, hint, __err_code);
995}
static char const * __Extract_locale_name(const char *loc, const char *category, char *buf)
static char const * __TranslateToSystem(const char *lname, char *buf, _Locale_lcid_t *hint, int *__err_code)

Referenced by _Locale_extract_collate_name(), _Locale_extract_ctype_name(), _Locale_extract_monetary_name(), _Locale_extract_numeric_name(), and _Locale_extract_time_name().

◆ _Locale_extract_collate_name()

char const * _Locale_extract_collate_name ( const char cname,
char buf,
_Locale_lcid_t hint,
int __err_code 
)

Definition at line 1009 of file c_locale_win32.c.

1011{ return _Locale_extract_category_name(cname, "LC_COLLATE", buf, hint, __err_code); }
static char const * _Locale_extract_category_name(const char *name, const char *category, char *buf, _Locale_lcid_t *hint, int *__err_code)

Referenced by __acquire_collate(), and _Stl_loc_combine_names_aux().

◆ _Locale_extract_ctype_name()

char const * _Locale_extract_ctype_name ( const char cname,
char buf,
_Locale_lcid_t hint,
int __err_code 
)

Definition at line 997 of file c_locale_win32.c.

999{ return _Locale_extract_category_name(cname, "LC_CTYPE", buf, hint, __err_code); }

Referenced by __acquire_codecvt(), __acquire_ctype(), and _Stl_loc_combine_names_aux().

◆ _Locale_extract_messages_name()

char const * _Locale_extract_messages_name ( const char cname,
char buf,
_Locale_lcid_t hint,
int __err_code 
)

Definition at line 1017 of file c_locale_win32.c.

1018 {
1019 if (cname[0] == 'L' && cname[1] == 'C' && cname[2] == '_') {
1020 return _C_name;
1021 }
1022 if (cname[0] == 'C' && cname[1] == 0) {
1023 return _C_name;
1024 }
1025 return __TranslateToSystem(cname, buf, hint, __err_code);
1026}

Referenced by __acquire_messages(), and _Stl_loc_combine_names_aux().

◆ _Locale_extract_monetary_name()

char const * _Locale_extract_monetary_name ( const char cname,
char buf,
_Locale_lcid_t hint,
int __err_code 
)

Definition at line 1013 of file c_locale_win32.c.

1015{ return _Locale_extract_category_name(cname, "LC_MONETARY", buf, hint, __err_code); }

Referenced by __acquire_monetary(), and _Stl_loc_combine_names_aux().

◆ _Locale_extract_numeric_name()

char const * _Locale_extract_numeric_name ( const char cname,
char buf,
_Locale_lcid_t hint,
int __err_code 
)

Definition at line 1001 of file c_locale_win32.c.

1003{ return _Locale_extract_category_name(cname, "LC_NUMERIC", buf, hint, __err_code); }

Referenced by __acquire_numeric(), and _Stl_loc_combine_names_aux().

◆ _Locale_extract_time_name()

char const * _Locale_extract_time_name ( const char cname,
char buf,
_Locale_lcid_t hint,
int __err_code 
)

Definition at line 1005 of file c_locale_win32.c.

1007{ return _Locale_extract_category_name(cname, "LC_TIME", buf, hint, __err_code); }

Referenced by __acquire_time(), and _Stl_loc_combine_names_aux().

◆ _Locale_false()

const char * _Locale_false ( _Locale_numeric_t lnum)

Definition at line 1174 of file c_locale_win32.c.

1174 {
1176 return __false_name; /* NT does't provide information about this */
1177}
static const char * __false_name

Referenced by numpunct_byname< char >::do_falsename().

◆ _Locale_final()

void _Locale_final ( void  )

Definition at line 1467 of file c_locale_win32.c.

void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

Referenced by ios_base::Init::~Init().

◆ _Locale_frac_digits()

char _Locale_frac_digits ( _Locale_monetary_t lmon)

◆ _Locale_full_dayofweek()

const char * _Locale_full_dayofweek ( _Locale_time_t ltime,
int  day 
)

Definition at line 1274 of file c_locale_win32.c.

1274 {
1275 const char **names = (const char**)ltime->dayofweek;
1276 return names[day];
1277}
char * dayofweek[7]

Referenced by _Init_timeinfo().

◆ _Locale_full_monthname()

const char * _Locale_full_monthname ( _Locale_time_t ltime,
int  month 
)

Definition at line 1264 of file c_locale_win32.c.

1264 {
1265 const char **names = (const char**)ltime->month;
1266 return names[month];
1267}
char * month[12]

Referenced by _Init_timeinfo().

◆ _Locale_get_collate_hint()

_Locale_lcid_t * _Locale_get_collate_hint ( _Locale_collate_t lcollate)

Definition at line 274 of file c_locale_win32.c.

275{ return (lcollate != 0) ? &lcollate->lc : 0; }

Referenced by _Locale_impl::insert_collate_facets().

◆ _Locale_get_ctype_hint()

_Locale_lcid_t * _Locale_get_ctype_hint ( _Locale_ctype_t ltype)

Definition at line 268 of file c_locale_win32.c.

269{ return (ltype != 0) ? &ltype->lc : 0; }

Referenced by _Locale_impl::insert_ctype_facets().

◆ _Locale_get_messages_hint()

_Locale_lcid_t * _Locale_get_messages_hint ( struct _Locale_messages *  lmessages)

Definition at line 278 of file c_locale_win32.c.

278 {
280 return 0;
281}

◆ _Locale_get_monetary_hint()

_Locale_lcid_t * _Locale_get_monetary_hint ( _Locale_monetary_t lmonetary)

Definition at line 276 of file c_locale_win32.c.

277{ return (lmonetary != 0) ? &lmonetary->lc : 0; }
_Locale_lcid_t lc

Referenced by _Locale_impl::insert_monetary_facets().

◆ _Locale_get_numeric_hint()

_Locale_lcid_t * _Locale_get_numeric_hint ( _Locale_numeric_t lnumeric)

Definition at line 270 of file c_locale_win32.c.

271{ return (lnumeric != 0) ? &lnumeric->lc : 0; }
_Locale_lcid_t lc

Referenced by _Locale_impl::insert_numeric_facets().

◆ _Locale_get_time_hint()

_Locale_lcid_t * _Locale_get_time_hint ( _Locale_time_t ltime)

Definition at line 272 of file c_locale_win32.c.

273{ return (ltime != 0) ? &ltime->lc : 0; }
_Locale_lcid_t lc

Referenced by _Locale_impl::insert_time_facets().

◆ _Locale_grouping()

const char * _Locale_grouping ( _Locale_numeric_t lnum)

Definition at line 1164 of file c_locale_win32.c.

1164 {
1165 if (!lnum->grouping) return "";
1166 else return lnum->grouping;
1167}

Referenced by numpunct_byname< char >::do_grouping(), and numpunct_byname< wchar_t >::do_grouping().

◆ _Locale_init()

void _Locale_init ( void  )

Definition at line 1464 of file c_locale_win32.c.

VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751

Referenced by ios_base::Init::Init().

◆ _Locale_int_curr_symbol()

const char * _Locale_int_curr_symbol ( _Locale_monetary_t lmon)

Definition at line 1180 of file c_locale_win32.c.

1181{ return lmon->int_curr_symbol; }

Referenced by moneypunct_byname< char, true >::do_curr_symbol().

◆ _Locale_int_frac_digits()

char _Locale_int_frac_digits ( _Locale_monetary_t lmon)

◆ _Locale_long_d_fmt()

const char * _Locale_long_d_fmt ( _Locale_time_t ltime)

Definition at line 1293 of file c_locale_win32.c.

1294{ return ltime->long_date_format; }
char * long_date_format

Referenced by _Init_timeinfo_base().

◆ _Locale_long_d_t_fmt()

const char * _Locale_long_d_t_fmt ( _Locale_time_t ltime)

Definition at line 1287 of file c_locale_win32.c.

1288{ return ltime->long_date_time_format; }
char * long_date_time_format

Referenced by _Init_timeinfo_base().

◆ _Locale_messages_create()

struct _Locale_messages * _Locale_messages_create ( const char name,
_Locale_lcid_t lc_hint,
int __err_code 
)

Definition at line 879 of file c_locale_win32.c.

879 {
880 /* The Win32 API has no support for messages facet */
884 return NULL;
885}
#define _STLP_LOC_UNSUPPORTED_FACET_CATEGORY
Definition: c_locale.h:100

Referenced by _Loc_messages_create().

◆ _Locale_messages_default()

const char * _Locale_messages_default ( char buf)

Definition at line 909 of file c_locale_win32.c.

910{ return _Locale_common_default(buf); }

Referenced by _Loc_messages_default(), and _Locale_impl::insert_messages_facets().

◆ _Locale_messages_destroy()

void _Locale_messages_destroy ( struct _Locale_messages *  lmes)

Definition at line 985 of file c_locale_win32.c.

Referenced by _Loc_messages_destroy().

◆ _Locale_messages_name()

char const * _Locale_messages_name ( const struct _Locale_messages *  lmes,
char buf 
)

Definition at line 930 of file c_locale_win32.c.

Referenced by _Loc_messages_name().

◆ _Locale_mon_decimal_point()

◆ _Locale_mon_grouping()

◆ _Locale_mon_thousands_sep()

◆ _Locale_monetary_create()

_Locale_monetary_t * _Locale_monetary_create ( const char name,
_Locale_lcid_t lc_hint,
int __err_code 
)

Definition at line 827 of file c_locale_win32.c.

827 {
828 char *GroupingBuffer;
829 int BufferSize;
830 char FracDigits[3];
831 wchar_t wbuf[6];
832
834 if (!lmon) { *__err_code = _STLP_LOC_NO_MEMORY; return lmon; }
835 memset(lmon, 0, sizeof(_Locale_monetary_t));
836
837 if (__GetLCIDFromName(name, &lmon->lc.id, lmon->cp, lc_hint) == -1)
838 { free(lmon); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
839
840 if (lmon->lc.id != INVARIANT_LCID) {
841 /* Extract information about monetary system */
842 __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SDECIMAL, lmon->decimal_point, 4, wbuf, 6);
843 __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_STHOUSAND, lmon->thousands_sep, 4, wbuf, 6);
844
846 GroupingBuffer = (char*)malloc(BufferSize);
847 if (!GroupingBuffer)
848 { lmon->grouping = NULL; *__err_code = _STLP_LOC_NO_MEMORY; return lmon; }
849 GetLocaleInfoA(lmon->lc.id, LOCALE_SGROUPING, GroupingBuffer, BufferSize);
850 __FixGrouping(GroupingBuffer);
851 lmon->grouping = GroupingBuffer;
852
853 __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SCURRENCY, lmon->curr_symbol, 6, wbuf, 6);
854 __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SNEGATIVESIGN, lmon->negative_sign, 5, wbuf, 6);
855 __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SPOSITIVESIGN, lmon->positive_sign, 5, wbuf, 6);
856
857 GetLocaleInfoA(lmon->lc.id, LOCALE_ICURRDIGITS, FracDigits, 3);
858 lmon->frac_digits = atoi(FracDigits);
859
860 GetLocaleInfoA(lmon->lc.id, LOCALE_IINTLCURRDIGITS, FracDigits, 3);
861 lmon->int_frac_digits = atoi(FracDigits);
862
863 __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SINTLSYMBOL, lmon->int_curr_symbol, 5, wbuf, 6);
864 /* Even if Platform SDK documentation says that the returned symbol should
865 * be a 3 letters symbol followed by a seperation character, experimentation
866 * has shown that no seperation character is ever appended. We are adding it
867 * ourself to conform to the POSIX specification.
868 */
869 if (lmon->int_curr_symbol[3] == 0) {
870 lmon->int_curr_symbol[3] = ' ';
871 lmon->int_curr_symbol[4] = 0;
872 }
873 }
874 /* else it is already ok */
875
876 return lmon;
877}
static void __FixGrouping(char *grouping)
static void __GetLocaleInfoUsingACP(LCID lcid, const char *cp, LCTYPE lctype, char *buf, int buf_size, wchar_t *wbuf, int wbuf_size)
char cp[MAX_CP_LEN+1]
#define LOCALE_ICURRDIGITS
Definition: winnls.h:54
#define LOCALE_SGROUPING
Definition: winnls.h:44
#define LOCALE_SDECIMAL
Definition: winnls.h:42
#define LOCALE_IINTLCURRDIGITS
Definition: winnls.h:55
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:117
#define LOCALE_STHOUSAND
Definition: winnls.h:43
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:118
#define LOCALE_SINTLSYMBOL
Definition: winnls.h:50
#define LOCALE_SCURRENCY
Definition: winnls.h:49

Referenced by _Loc_monetary_create().

◆ _Locale_monetary_default()

const char * _Locale_monetary_default ( char buf)

Definition at line 906 of file c_locale_win32.c.

907{ return _Locale_common_default(buf); }

Referenced by _Loc_monetary_default(), and _Locale_impl::insert_monetary_facets().

◆ _Locale_monetary_destroy()

void _Locale_monetary_destroy ( _Locale_monetary_t lmon)

Definition at line 978 of file c_locale_win32.c.

978 {
979 if (!lmon) return;
980
981 if (lmon->grouping) free(lmon->grouping);
982 free(lmon);
983}

Referenced by _Loc_monetary_destroy().

◆ _Locale_monetary_name()

char const * _Locale_monetary_name ( const _Locale_monetary_t lmon,
char buf 
)

Definition at line 927 of file c_locale_win32.c.

928{ return __GetLocaleName(lmon->lc.id, lmon->cp, buf); }

◆ _Locale_n_cs_precedes()

int _Locale_n_cs_precedes ( _Locale_monetary_t lmon)

Definition at line 1236 of file c_locale_win32.c.

1236 {
1237 char loc_data[2];
1238 GetLocaleInfoA(lmon->lc.id, LOCALE_INEGSYMPRECEDES, loc_data, 2);
1239 if (loc_data[0] == '0') return 0;
1240 else if (loc_data[0] == '1') return 1;
1241 else return -1;
1242}
#define LOCALE_INEGSYMPRECEDES
Definition: winnls.h:123

Referenced by _Init_monetary_formats(), and _Init_monetary_formats_int().

◆ _Locale_n_sep_by_space()

int _Locale_n_sep_by_space ( _Locale_monetary_t lmon)

Definition at line 1244 of file c_locale_win32.c.

1244 {
1245 char loc_data[2];
1246 GetLocaleInfoA(lmon->lc.id, LOCALE_INEGSEPBYSPACE, loc_data, 2);
1247 if (loc_data[0] == '0') return 0;
1248 else if (loc_data[0] == '1') return 1;
1249 else return -1;
1250}
#define LOCALE_INEGSEPBYSPACE
Definition: winnls.h:124

Referenced by _Init_monetary_formats().

◆ _Locale_n_sign_posn()

int _Locale_n_sign_posn ( _Locale_monetary_t lmon)

Definition at line 1252 of file c_locale_win32.c.

1252 {
1253 char loc_data[2];
1254 if (lmon->lc.id != INVARIANT_LCID) {
1255 GetLocaleInfoA(lmon->lc.id, LOCALE_INEGSIGNPOSN, loc_data, 2);
1256 return atoi(loc_data);
1257 }
1258 else {
1259 return CHAR_MAX;
1260 }
1261}
#define LOCALE_INEGSIGNPOSN
Definition: winnls.h:120

Referenced by _Init_monetary_formats(), and _Init_monetary_formats_int().

◆ _Locale_negative_sign()

const char * _Locale_negative_sign ( _Locale_monetary_t lmon)

◆ _Locale_numeric_create()

_Locale_numeric_t * _Locale_numeric_create ( const char name,
_Locale_lcid_t lc_hint,
int __err_code 
)

Definition at line 387 of file c_locale_win32.c.

387 {
388 wchar_t wbuf[4];
389 char *GroupingBuffer;
390 int BufferSize;
391
393 if (!lnum) { *__err_code = _STLP_LOC_NO_MEMORY; return lnum; }
394 memset(lnum, 0, sizeof(_Locale_numeric_t));
395
396 if (__GetLCIDFromName(name, &lnum->lc.id, lnum->cp, lc_hint) == -1)
397 { free(lnum); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
398
399#if defined (__BORLANDC__)
400 if (lnum->lc.id != INVARIANT_LCID) {
401#endif
402 __GetLocaleInfoUsingACP(lnum->lc.id, lnum->cp, LOCALE_SDECIMAL, lnum->decimal_point, 4, wbuf, 4);
403 __GetLocaleInfoUsingACP(lnum->lc.id, lnum->cp, LOCALE_STHOUSAND, lnum->thousands_sep, 4, wbuf, 4);
404#if defined (__BORLANDC__)
405 }
406 else
407 lnum->decimal_point[0] = '.';
408#endif
409
410 if (lnum->lc.id != INVARIANT_LCID) {
412 GroupingBuffer = (char*)malloc(BufferSize);
413 if (!GroupingBuffer) { free(lnum); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
414 GetLocaleInfoA(lnum->lc.id, LOCALE_SGROUPING, GroupingBuffer, BufferSize);
415 __FixGrouping(GroupingBuffer);
416 lnum->grouping = GroupingBuffer;
417 }
418 else {
419 lnum->grouping = (char*)malloc(1);
420 if (!lnum->grouping) { free(lnum); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
421 lnum->grouping[0] = 0;
422 }
423
424 return lnum;
425}
char cp[MAX_CP_LEN+1]

Referenced by _Loc_numeric_create().

◆ _Locale_numeric_default()

const char * _Locale_numeric_default ( char buf)

Definition at line 897 of file c_locale_win32.c.

898{ return _Locale_common_default(buf); }

Referenced by _Loc_numeric_default(), and _Locale_impl::insert_numeric_facets().

◆ _Locale_numeric_destroy()

void _Locale_numeric_destroy ( _Locale_numeric_t lnum)

Definition at line 942 of file c_locale_win32.c.

942 {
943 if (!lnum) return;
944
945 if (lnum->grouping) free(lnum->grouping);
946 free(lnum);
947}

Referenced by _Loc_numeric_destroy().

◆ _Locale_numeric_name()

char const * _Locale_numeric_name ( const _Locale_numeric_t lnum,
char buf 
)

Definition at line 918 of file c_locale_win32.c.

919{ return __GetLocaleName(lnum->lc.id, lnum->cp, buf); }

◆ _Locale_p_cs_precedes()

int _Locale_p_cs_precedes ( _Locale_monetary_t lmon)

Definition at line 1209 of file c_locale_win32.c.

1209 {
1210 char loc_data[2];
1211 GetLocaleInfoA(lmon->lc.id, LOCALE_IPOSSYMPRECEDES, loc_data, 2);
1212 if (loc_data[0] == '0') return 0;
1213 else if (loc_data[0] == '1') return 1;
1214 else return -1;
1215}
#define LOCALE_IPOSSYMPRECEDES
Definition: winnls.h:121

Referenced by _Init_monetary_formats(), and _Init_monetary_formats_int().

◆ _Locale_p_sep_by_space()

int _Locale_p_sep_by_space ( _Locale_monetary_t lmon)

Definition at line 1217 of file c_locale_win32.c.

1217 {
1218 char loc_data[2];
1219 GetLocaleInfoA(lmon->lc.id, LOCALE_IPOSSEPBYSPACE, loc_data, 2);
1220 if (loc_data[0] == '0') return 0;
1221 else if (loc_data[0] == '1') return 1;
1222 else return -1;
1223}
#define LOCALE_IPOSSEPBYSPACE
Definition: winnls.h:122

Referenced by _Init_monetary_formats().

◆ _Locale_p_sign_posn()

int _Locale_p_sign_posn ( _Locale_monetary_t lmon)

Definition at line 1225 of file c_locale_win32.c.

1225 {
1226 char loc_data[2];
1227 if (lmon->lc.id != INVARIANT_LCID) {
1228 GetLocaleInfoA(lmon->lc.id, LOCALE_IPOSSIGNPOSN, loc_data, 2);
1229 return atoi(loc_data);
1230 }
1231 else {
1232 return CHAR_MAX;
1233 }
1234}
#define LOCALE_IPOSSIGNPOSN
Definition: winnls.h:119

Referenced by _Init_monetary_formats(), and _Init_monetary_formats_int().

◆ _Locale_pm_str()

const char * _Locale_pm_str ( _Locale_time_t ltime)

Definition at line 1302 of file c_locale_win32.c.

1303{ return ltime->pm; }

Referenced by _Init_timeinfo().

◆ _Locale_positive_sign()

const char * _Locale_positive_sign ( _Locale_monetary_t lmon)

◆ _Locale_strcmp()

int _Locale_strcmp ( _Locale_collate_t lcol,
const char s1,
size_t  n1,
const char s2,
size_t  n2 
)

Definition at line 1103 of file c_locale_win32.c.

1105 {
1106 int result;
1107 if (__GetDefaultCP(lcol->lc.id) == atoi(lcol->cp)) {
1108 result = _Locale_strcmp_auxA(lcol, s1, n1, s2, n2);
1109 }
1110 else {
1111 char *buf1, *buf2;
1112 size_t size1, size2;
1113 buf1 = __ConvertToCP(atoi(lcol->cp), __GetDefaultCP(lcol->lc.id), s1, n1, &size1);
1114 buf2 = __ConvertToCP(atoi(lcol->cp), __GetDefaultCP(lcol->lc.id), s2, n2, &size2);
1115
1116 result = _Locale_strcmp_auxA(lcol, buf1, size1, buf2, size2);
1117 free(buf1); free(buf2);
1118 }
1119 return (result == CSTR_EQUAL) ? 0 : (result == CSTR_LESS_THAN) ? -1 : 1;
1120}
#define CSTR_EQUAL
static int _Locale_strcmp_auxA(_Locale_collate_t *lcol, const char *s1, size_t n1, const char *s2, size_t n2)
#define CSTR_LESS_THAN
static char * __ConvertToCP(int from_cp, int to_cp, const char *from, size_t size, size_t *ret_buf_size)
struct S1 s1
struct S2 s2
int n2
Definition: dwarfget.c:147
int n1
Definition: dwarfget.c:147

Referenced by collate_byname< char >::do_compare().

◆ _Locale_strcmp_auxA()

static int _Locale_strcmp_auxA ( _Locale_collate_t lcol,
const char s1,
size_t  n1,
const char s2,
size_t  n2 
)
static

Definition at line 1087 of file c_locale_win32.c.

1089 {
1090 int result = CSTR_EQUAL;
1091 while (n1 > 0 || n2 > 0) {
1092 DWORD size1 = trim_size_t_to_DWORD(n1);
1093 DWORD size2 = trim_size_t_to_DWORD(n2);
1094 result = CompareStringA(lcol->lc.id, 0, s1, size1, s2, size2);
1095 if (result != CSTR_EQUAL)
1096 break;
1097 n1 -= size1;
1098 n2 -= size2;
1099 }
1100 return result;
1101}
static DWORD trim_size_t_to_DWORD(size_t n)
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
Definition: locale.c:4082
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by _Locale_strcmp().

◆ _Locale_strxfrm()

size_t _Locale_strxfrm ( _Locale_collate_t lcol,
char dst,
size_t  dst_size,
const char src,
size_t  src_size 
)

Definition at line 1122 of file c_locale_win32.c.

1124 {
1125 int result;
1126
1127 /* The Windows API do not support transformation of very long strings (src_size > INT_MAX)
1128 * In this case the result will just be the input string:
1129 */
1130 if (src_size > INT_MAX) {
1131 if (dst != 0) {
1132 _STLP_STRNCPY(dst, dst_size, src, src_size);
1133 }
1134 return src_size;
1135 }
1136 if (dst_size > INT_MAX) {
1137 /* now that we know that src_size <= INT_MAX we can safely decrease dst_size to INT_MAX. */
1138 dst_size = INT_MAX;
1139 }
1140
1141 if (__GetDefaultCP(lcol->lc.id) == atoi(lcol->cp))
1142 result = LCMapStringA(lcol->lc.id, LCMAP_SORTKEY, src, (int)src_size, dst, (int)dst_size);
1143 else {
1144 char *buf;
1145 size_t size;
1146 buf = __ConvertToCP(atoi(lcol->cp), __GetDefaultCP(lcol->lc.id), src, src_size, &size);
1147
1148 result = LCMapStringA(lcol->lc.id, LCMAP_SORTKEY, buf, (int)size, dst, (int)dst_size);
1149 free(buf);
1150 }
1151 return result != 0 ? result - 1 : 0;
1152}
INT WINAPI LCMapStringA(LCID lcid, DWORD flags, LPCSTR src, INT srclen, LPSTR dst, INT dstlen)
Definition: locale.c:3830
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define INT_MAX
Definition: limits.h:40
#define LCMAP_SORTKEY
Definition: winnls.h:186

Referenced by collate_byname< char >::do_transform().

◆ _Locale_t_fmt()

const char * _Locale_t_fmt ( _Locale_time_t ltime)

Definition at line 1296 of file c_locale_win32.c.

1297{ return ltime->time_format; }
char * time_format

Referenced by _Init_timeinfo_base().

◆ _Locale_thousands_sep()

char _Locale_thousands_sep ( _Locale_numeric_t lnum)

Definition at line 1161 of file c_locale_win32.c.

1162{ return lnum->thousands_sep[0]; }

Referenced by numpunct_byname< char >::do_thousands_sep().

◆ _Locale_time_create()

_Locale_time_t * _Locale_time_create ( const char name,
_Locale_lcid_t lc_hint,
int __err_code 
)

Definition at line 713 of file c_locale_win32.c.

713 {
714 int size, month, dayofweek;
715 size_t length;
716 char fmt80[80];
717 wchar_t wbuf80[80];
718
720
721 if (!ltime) { *__err_code = _STLP_LOC_NO_MEMORY; return ltime; }
722 memset(ltime, 0, sizeof(_Locale_time_t));
723
724 if (__GetLCIDFromName(name, &ltime->lc.id, ltime->cp, lc_hint) == -1)
725 { free(ltime); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
726
727#if defined (__BORLANDC__)
728 if ( ltime->lc.id == INVARIANT_LCID && name[0] == 'C' && name[1] == 0 )
729 { ltime->lc.id = 0x409; }
730#endif
731
732 for (month = LOCALE_SMONTHNAME1; month <= LOCALE_SMONTHNAME12; ++month) { /* Small hack :-) */
733 size = GetLocaleInfoA(ltime->lc.id, month, NULL, 0);
734 ltime->month[month - LOCALE_SMONTHNAME1] = (char*)malloc(size);
735 if (!ltime->month[month - LOCALE_SMONTHNAME1])
736 { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
737 __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, month, ltime->month[month - LOCALE_SMONTHNAME1], size, wbuf80, 80);
738 }
739
741 size = GetLocaleInfoA(ltime->lc.id, month, NULL, 0);
744 { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
745 __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, month, ltime->abbrev_month[month - LOCALE_SABBREVMONTHNAME1], size, wbuf80, 80);
746 }
747
748 for (dayofweek = LOCALE_SDAYNAME1; dayofweek <= LOCALE_SDAYNAME7; ++dayofweek) {
749 int dayindex = ( dayofweek != LOCALE_SDAYNAME7 ) ? dayofweek - LOCALE_SDAYNAME1 + 1 : 0;
750 size = GetLocaleInfoA(ltime->lc.id, dayofweek, NULL, 0);
751 ltime->dayofweek[dayindex] = (char*)malloc(size);
752 if (!ltime->dayofweek[dayindex])
753 { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
754 __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, dayofweek, ltime->dayofweek[dayindex], size, wbuf80, 80);
755 }
756
757 for (dayofweek = LOCALE_SABBREVDAYNAME1; dayofweek <= LOCALE_SABBREVDAYNAME7; ++dayofweek) {
758 int dayindex = ( dayofweek != LOCALE_SABBREVDAYNAME7 ) ? dayofweek - LOCALE_SABBREVDAYNAME1 + 1 : 0;
759 size = GetLocaleInfoA(ltime->lc.id, dayofweek, NULL, 0);
760 ltime->abbrev_dayofweek[dayindex] = (char*)malloc(size);
761 if (!ltime->abbrev_dayofweek[dayindex])
762 { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
763 __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, dayofweek, ltime->abbrev_dayofweek[dayindex], size, wbuf80, 80);
764 }
765
766 __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_SSHORTDATE, fmt80, 80, wbuf80, 80);
767 size = __ConvertDate(fmt80, NULL, 0);
768 ltime->date_format = (char*)malloc(size);
769 if (!ltime->date_format)
770 { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
771 __ConvertDate(fmt80, ltime->date_format, size);
772
773 __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_SLONGDATE, fmt80, 80, wbuf80, 80);
774 size = __ConvertDate(fmt80, NULL, 0);
775 ltime->long_date_format = (char*)malloc(size);
776 if (!ltime->long_date_format)
777 { _Locale_time_destroy(ltime);*__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
778 __ConvertDate(fmt80, ltime->long_date_format, size);
779
780 __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_STIMEFORMAT, fmt80, 80, wbuf80, 80);
781 size = __ConvertTime(fmt80, NULL, 0);
782 ltime->time_format = (char*)malloc(size);
783 if (!ltime->time_format)
784 { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
785 __ConvertTime(fmt80, ltime->time_format, size);
786
787 /* NT doesn't provide this information, we must simulate. */
788 length = strlen(ltime->date_format) + strlen(ltime->time_format) + 1 /* space */ + 1 /* trailing 0 */;
789 ltime->date_time_format = (char*)malloc(length);
790 if (!ltime->date_time_format)
791 { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
795
796 /* NT doesn't provide this information, we must simulate. */
797 length = strlen(ltime->long_date_format) + strlen(ltime->time_format) + 1 /* space */ + 1 /* trailing 0 */;
798 ltime->long_date_time_format = (char*)malloc(length);
799 if (!ltime->long_date_time_format)
800 { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
804
805 __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_S1159, ltime->am, 9, wbuf80, 80);
806 __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_S2359, ltime->pm, 9, wbuf80, 80);
807
808 return ltime;
809}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
void _Locale_time_destroy(_Locale_time_t *ltime)
static int __ConvertDate(const char *NTDate, char *buffer, int buf_size)
static int __ConvertTime(const char *NTTime, char *buffer, int buf_size)
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
char cp[MAX_CP_LEN+1]
#define LOCALE_SMONTHNAME12
Definition: winnls.h:102
#define LOCALE_SDAYNAME1
Definition: winnls.h:77
#define LOCALE_SLONGDATE
Definition: winnls.h:61
#define LOCALE_S1159
Definition: winnls.h:71
#define LOCALE_SSHORTDATE
Definition: winnls.h:60
#define LOCALE_SMONTHNAME1
Definition: winnls.h:91
#define LOCALE_SDAYNAME7
Definition: winnls.h:83
#define LOCALE_SABBREVMONTHNAME1
Definition: winnls.h:104
#define LOCALE_STIMEFORMAT
Definition: winnls.h:62
#define LOCALE_SABBREVDAYNAME1
Definition: winnls.h:84
#define LOCALE_S2359
Definition: winnls.h:72
#define LOCALE_SABBREVMONTHNAME12
Definition: winnls.h:115
#define LOCALE_SABBREVDAYNAME7
Definition: winnls.h:90

Referenced by _Loc_time_create().

◆ _Locale_time_default()

const char * _Locale_time_default ( char buf)

Definition at line 900 of file c_locale_win32.c.

901{ return _Locale_common_default(buf); }

Referenced by _Loc_time_default(), and _Locale_impl::insert_time_facets().

◆ _Locale_time_destroy()

void _Locale_time_destroy ( _Locale_time_t ltime)

Definition at line 949 of file c_locale_win32.c.

949 {
950 int i;
951 if (!ltime) return;
952
953 for (i = 0; i < 12; ++i) {
954 if (ltime->month[i]) free(ltime->month[i]);
955 if (ltime->abbrev_month[i]) free(ltime->abbrev_month[i]);
956 }
957
958 for (i = 0; i < 7; ++i) {
959 if (ltime->dayofweek[i]) free(ltime->dayofweek[i]);
960 if (ltime->abbrev_dayofweek[i]) free(ltime->abbrev_dayofweek[i]);
961 }
962
963 if (ltime->date_format) free(ltime->date_format);
964 if (ltime->long_date_format) free(ltime->long_date_format);
965 if (ltime->time_format) free(ltime->time_format);
966 if (ltime->date_time_format) free(ltime->date_time_format);
968
969 free(ltime);
970}

Referenced by _Loc_time_destroy(), and _Locale_time_create().

◆ _Locale_time_name()

char const * _Locale_time_name ( const _Locale_time_t ltime,
char buf 
)

Definition at line 921 of file c_locale_win32.c.

922{ return __GetLocaleName(ltime->lc.id, ltime->cp, buf); }

◆ _Locale_tolower()

int _Locale_tolower ( _Locale_ctype_t ltype,
int  c 
)

Definition at line 1055 of file c_locale_win32.c.

1055 {
1056 char buf[2], out_buf[2];
1057 buf[0] = (char)c; buf[1] = 0;
1058 if ((UINT)__GetDefaultCP(ltype->lc.id) == ltype->cp) {
1059 LCMapStringA(ltype->lc.id, LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE, buf, 2, out_buf, 2);
1060 return out_buf[0];
1061 }
1062 else {
1063 wchar_t wbuf[2];
1064 MultiByteToWideChar(ltype->cp, MB_PRECOMPOSED, buf, 2, wbuf, 2);
1066
1067 LCMapStringA(ltype->lc.id, LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE, buf, 2, out_buf, 2);
1068
1069 MultiByteToWideChar(__GetDefaultCP(ltype->lc.id), MB_PRECOMPOSED, out_buf, 2, wbuf, 2);
1070 WideCharToMultiByte(ltype->cp, WC_COMPOSITECHECK | WC_SEPCHARS, wbuf, 2, out_buf, 2, NULL, FALSE);
1071 return out_buf[0];
1072 }
1073}
unsigned char
Definition: typeof.h:29
const GLubyte * c
Definition: glext.h:8905
#define LCMAP_LINGUISTIC_CASING
Definition: winnls.h:192
#define LCMAP_LOWERCASE
Definition: winnls.h:184

Referenced by ctype_byname< char >::do_tolower().

◆ _Locale_toupper()

int _Locale_toupper ( _Locale_ctype_t ltype,
int  c 
)

Definition at line 1035 of file c_locale_win32.c.

1035 {
1036 char buf[2], out_buf[2];
1037 buf[0] = (char)c; buf[1] = 0;
1038 if ((UINT)__GetDefaultCP(ltype->lc.id) == ltype->cp) {
1039 LCMapStringA(ltype->lc.id, LCMAP_LINGUISTIC_CASING | LCMAP_UPPERCASE, buf, 2, out_buf, 2);
1040 return out_buf[0];
1041 }
1042 else {
1043 wchar_t wbuf[2];
1044 MultiByteToWideChar(ltype->cp, MB_PRECOMPOSED, buf, 2, wbuf, 2);
1046
1047 LCMapStringA(ltype->lc.id, LCMAP_LINGUISTIC_CASING | LCMAP_UPPERCASE, buf, 2, out_buf, 2);
1048
1049 MultiByteToWideChar(__GetDefaultCP(ltype->lc.id), MB_PRECOMPOSED, out_buf, 2, wbuf, 2);
1050 WideCharToMultiByte(ltype->cp, WC_COMPOSITECHECK | WC_SEPCHARS, wbuf, 2, out_buf, 2, NULL, FALSE);
1051 return out_buf[0];
1052 }
1053}
#define LCMAP_UPPERCASE
Definition: winnls.h:185

Referenced by ctype_byname< char >::do_toupper().

◆ _Locale_true()

const char * _Locale_true ( _Locale_numeric_t lnum)

Definition at line 1169 of file c_locale_win32.c.

1169 {
1171 return __true_name; /* NT does't provide information about this */
1172}
static const char * __true_name

Referenced by numpunct_byname< char >::do_truename().

◆ EnumLocalesProcA()

static BOOL CALLBACK EnumLocalesProcA ( LPSTR  locale)
static

Definition at line 1484 of file c_locale_win32.c.

1484 {
1485 LCID lcid = LocaleFromHex(locale);
1486 int LangFlag = 0, CtryFlag = !__FndCtry;
1487 static char Lang[MAX_LANG_LEN], Ctry[MAX_CTRY_LEN];
1488
1490 if (lstrcmpiA(Lang, __FndLang) != 0) {
1492 if (lstrcmpiA(Lang, __FndLang) != 0) {
1494 if (lstrcmpiA(Lang, __FndLang) == 0) LangFlag = 1;
1495 }
1496 else LangFlag = 1;
1497 }
1498 else LangFlag = 1;
1499
1500 if (__FndCtry) {
1502 if (lstrcmpiA(Ctry, __FndCtry) != 0) {
1504 if (lstrcmpiA(Ctry, __FndCtry) != 0) {
1506 if (lstrcmpiA(Ctry, __FndCtry) == 0) CtryFlag = 1;
1507 }
1508 else CtryFlag = 1;
1509 }
1510 else
1511 CtryFlag = 1;
1512 }
1513
1514 if (LangFlag && CtryFlag) {
1515 __FindFlag = 1;
1516 __FndLCID = lcid;
1517 return FALSE;
1518 }
1519
1520 return TRUE;
1521}
static LCID LocaleFromHex(const char *locale)
Definition: _locale.h:75
#define TRUE
Definition: types.h:120
#define LOCALE_SISO639LANGNAME
Definition: winnls.h:126
#define LOCALE_SISO3166CTRYNAME
Definition: winnls.h:127
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:28
#define LOCALE_SABBREVCTRYNAME
Definition: winnls.h:33

Referenced by __GetLCID().

◆ LocaleFromHex()

static LCID LocaleFromHex ( const char locale)
static

Definition at line 1470 of file c_locale_win32.c.

1470 {
1471 unsigned long result = 0;
1472 int digit;
1473 while (*locale) {
1474 result <<= 4;
1475 digit = (*locale >= '0' && *locale <= '9') ? *locale - '0':
1476 (*locale >= 'A' && *locale <= 'F') ? (*locale - 'A') + 10
1477 : (*locale - 'a') + 10;
1478 result += digit;
1479 ++locale;
1480 }
1481 return (LCID)result;
1482}

Referenced by EnumLocalesProcA().

◆ MapCtypeMask()

unsigned short MapCtypeMask ( unsigned short  mask)

Definition at line 284 of file c_locale_win32.c.

284 {
285 unsigned short ret = 0;
291 /* MAP(C1_BLANK, ?); */
294 if ((mask & C1_CNTRL) != 0) { ret |= _Locale_CNTRL; ret &= ~_Locale_PRINT; }
295 return ret;
296}
#define MAP(x, y)
GLenum GLint GLuint mask
Definition: glext.h:6028
#define C1_CNTRL
Definition: unicode.h:36
#define C1_DIGIT
Definition: unicode.h:33
#define C1_PUNCT
Definition: unicode.h:35
#define C1_SPACE
Definition: unicode.h:34
#define C1_ALPHA
Definition: unicode.h:39
#define C1_LOWER
Definition: unicode.h:32
#define C1_UPPER
Definition: unicode.h:31
#define C1_XDIGIT
Definition: unicode.h:38
#define _Locale_CNTRL
Definition: c_locale.h:122
#define _Locale_LOWER
Definition: c_locale.h:124
#define _Locale_XDIGIT
Definition: c_locale.h:128
#define _Locale_SPACE
Definition: c_locale.h:120
#define _Locale_PUNCT
Definition: c_locale.h:127
#define _Locale_ALPHA
Definition: c_locale.h:125
#define _Locale_UPPER
Definition: c_locale.h:123
#define _Locale_DIGIT
Definition: c_locale.h:126
#define _Locale_PRINT
Definition: c_locale.h:121

Referenced by _Locale_ctype_create(), _WLocale_ctype(), and MapCtypeMasks().

◆ MapCtypeMasks()

static void MapCtypeMasks ( unsigned short cur,
unsigned short end 
)
static

Definition at line 298 of file c_locale_win32.c.

298 {
299 for (; cur != end; ++cur) {
300 *cur = MapCtypeMask(*cur);
301 }
302}
FxCollectionEntry * cur
GLuint GLuint end
Definition: gl.h:1545

Referenced by _Locale_ctype_create().

◆ my_ltoa()

void my_ltoa ( long  __x,
char buf 
)
static

Definition at line 248 of file c_locale_win32.c.

248 {
249 char rbuf[64];
250 char* ptr = rbuf;
251
252 if (__x == 0)
253 *ptr++ = '0';
254 else {
255 for (; __x != 0; __x /= 10)
256 *ptr++ = (char)(__x % 10) + '0';
257 }
258 while(ptr > rbuf) *buf++ = *--ptr;
259 /* psw */
260 *buf = '\0';
261}

Referenced by __GetLCIDFromName(), _Locale_codecvt_name(), _Locale_common_default(), and _Locale_ctype_name().

◆ trim_size_t_to_DWORD()

static DWORD trim_size_t_to_DWORD ( size_t  n)
static

Definition at line 1083 of file c_locale_win32.c.

1083{ return n < (size_t)max_DWORD ? (DWORD)n : max_DWORD; }
static DWORD max_DWORD
__kernel_size_t size_t
Definition: linux.h:237
GLdouble n
Definition: glext.h:7729

Referenced by _Locale_strcmp_auxA(), and _WLocale_strcmp_aux().

◆ trim_size_t_to_int()

static int trim_size_t_to_int ( size_t  n)
static

Definition at line 1715 of file c_locale_win32.c.

1715{ return n < (size_t)INT_MAX ? (int)n : INT_MAX; }

Referenced by __ConvertToCP().

Variable Documentation

◆ __criticalSection

CRITICAL_SECTION __criticalSection
static

Definition at line 1458 of file c_locale_win32.c.

Referenced by __GetLCID(), _Locale_final(), and _Locale_init().

◆ __false_name

const char* __false_name = "false"
static

Definition at line 1156 of file c_locale_win32.c.

Referenced by _Locale_false().

◆ __FindFlag

int __FindFlag
static

Definition at line 1459 of file c_locale_win32.c.

Referenced by __GetLCID(), and EnumLocalesProcA().

◆ __FndCtry

const char* __FndCtry
static

Definition at line 1462 of file c_locale_win32.c.

Referenced by __GetLCID(), and EnumLocalesProcA().

◆ __FndLang

const char* __FndLang
static

Definition at line 1461 of file c_locale_win32.c.

Referenced by __GetLCID(), and EnumLocalesProcA().

◆ __FndLCID

LCID __FndLCID
static

Definition at line 1460 of file c_locale_win32.c.

Referenced by __GetLCID(), and EnumLocalesProcA().

◆ __rg_country

LOCALECONV __rg_country[]
static
Initial value:
= {
{"america", "USA"},
{"britain", "GBR"},
{"china", "CHN"},
{"czech", "CZE"},
{"england", "GBR"},
{"great britain", "GBR"},
{"holland", "NLD"},
{"hong-kong", "HKG"},
{"new-zealand", "NZL"},
{"nz", "NZL"},
{"pr china", "CHN"},
{"pr-china", "CHN"},
{"puerto-rico", "PRI"},
{"slovak", "SVK"},
{"south africa", "ZAF"},
{"south korea", "KOR"},
{"south-africa", "ZAF"},
{"south-korea", "KOR"},
{"trinidad & tobago", "TTO"},
{"uk", "GBR"},
{"united-kingdom", "GBR"},
{"united-states", "USA"},
{"us", "USA"},
}

Definition at line 153 of file c_locale_win32.c.

Referenced by __GetLCIDFromName().

◆ __rg_language

LOCALECONV __rg_language[]
static

Definition at line 84 of file c_locale_win32.c.

Referenced by __GetLCIDFromName().

◆ __true_name

const char* __true_name = "true"
static

Definition at line 1155 of file c_locale_win32.c.

Referenced by _Locale_true().

◆ _C_name

const char* _C_name = "C"
static

Definition at line 81 of file c_locale_win32.c.

Referenced by __GetLocaleName(), and _Locale_extract_messages_name().

◆ max_DWORD

DWORD max_DWORD = 0xffffffff
static

Definition at line 1082 of file c_locale_win32.c.

Referenced by trim_size_t_to_DWORD().