xref: /reactos/sdk/lib/crt/include/internal/locale.h (revision 6f6b8317)
1 #ifndef __CRT_INTERNAL_LOCALE_H
2 #define __CRT_INTERNAL_LOCALE_H
3 
4 #include <crtdefs.h> // for LC_ID
5 
6 typedef struct MSVCRT_threadlocaleinfostruct {
7     LONG refcount;
8     unsigned int lc_codepage;
9     unsigned int lc_collate_cp;
10     unsigned long lc_handle[6];
11     LC_ID lc_id[6];
12     struct {
13         char *locale;
14         wchar_t *wlocale;
15         int *refcount;
16         int *wrefcount;
17     } lc_category[6];
18     int lc_clike;
19     int mb_cur_max;
20     int *lconv_intl_refcount;
21     int *lconv_num_refcount;
22     int *lconv_mon_refcount;
23     struct lconv *lconv;
24     int *ctype1_refcount;
25     unsigned short *ctype1;
26     const unsigned short *pctype;
27     unsigned char *pclmap;
28     unsigned char *pcumap;
29     struct __lc_time_data *lc_time_curr;
30 } MSVCRT_threadlocinfo;
31 
32 typedef struct MSVCRT_threadmbcinfostruct {
33     LONG refcount;
34     int mbcodepage;
35     int ismbcodepage;
36     int mblcid;
37     unsigned short mbulinfo[6];
38     unsigned char mbctype[257];
39     char mbcasemap[256];
40 } MSVCRT_threadmbcinfo;
41 
42 #define MSVCRT_lconv lconv
43 
44 typedef struct MSVCRT_threadlocaleinfostruct *MSVCRT_pthreadlocinfo;
45 typedef struct MSVCRT_threadmbcinfostruct *MSVCRT_pthreadmbcinfo;
46 
47 typedef struct MSVCRT_localeinfo_struct
48 {
49     MSVCRT_pthreadlocinfo locinfo;
50     MSVCRT_pthreadmbcinfo mbcinfo;
51 } MSVCRT__locale_tstruct, *MSVCRT__locale_t;
52 
53 typedef struct __lc_time_data {
54     union {
55         char *str[43];
56         struct {
57             char *short_wday[7];
58             char *wday[7];
59             char *short_mon[12];
60             char *mon[12];
61             char *am;
62             char *pm;
63             char *short_date;
64             char *date;
65             char *time;
66         } names;
67     } str;
68     LCID lcid;
69     int  unk[2];
70     wchar_t *wstr[43];
71     char data[1];
72 } MSVCRT___lc_time_data;
73 
74 int _setmbcp_l(int, LCID, MSVCRT_pthreadmbcinfo) DECLSPEC_HIDDEN;
75 MSVCRT_pthreadmbcinfo get_mbcinfo(void) DECLSPEC_HIDDEN;
76 LCID MSVCRT_locale_to_LCID(const char*, unsigned short*) DECLSPEC_HIDDEN;
77 
78 void __init_global_locale();
79 extern MSVCRT__locale_t global_locale;
80 #define MSVCRT_locale __get_MSVCRT_locale()
__get_MSVCRT_locale()81 FORCEINLINE MSVCRT__locale_t __get_MSVCRT_locale()
82 {
83     if(!global_locale)
84         __init_global_locale();
85     return global_locale;
86 }
87 
88 MSVCRT_pthreadlocinfo get_locinfo(void);
89 void __cdecl MSVCRT__free_locale(MSVCRT__locale_t);
90 void free_locinfo(MSVCRT_pthreadlocinfo);
91 void free_mbcinfo(MSVCRT_pthreadmbcinfo);
92 
93 #endif //__CRT_INTERNAL_LOCALE_H
94 
95