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