msvcrt: _Gettnames() should respect user overrides.
[wine.git] / include / msvcrt / crtdefs.h
bloba9edef57c4f5867faebc66c54504ee88cf77036a
1 /*
2 * CRT definitions
4 * Copyright 2000 Francois Gouget.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_CRTDEFS_H
22 #define __WINE_CRTDEFS_H
24 #ifndef __WINE_USE_MSVCRT
25 #define __WINE_USE_MSVCRT
26 #endif
28 #ifdef __WINE_WINE_PORT_H
29 # error You cannot use both wine/port.h and msvcrt headers
30 #endif
32 #if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
33 #define _WIN64
34 #endif
36 #if !defined(_MSC_VER) && !defined(__int64)
37 # if defined(_WIN64) && !defined(__MINGW64__)
38 # define __int64 long
39 # else
40 # define __int64 long long
41 # endif
42 #endif
44 #ifndef __stdcall
45 # ifdef __i386__
46 # ifdef __GNUC__
47 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
48 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
49 # else
50 # define __stdcall __attribute__((__stdcall__))
51 # endif
52 # elif defined(_MSC_VER)
53 /* Nothing needs to be done. __stdcall already exists */
54 # else
55 # error You need to define __stdcall for your compiler
56 # endif
57 # elif defined(__x86_64__) && defined (__GNUC__)
58 # if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
59 # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
60 # else
61 # define __stdcall __attribute__((ms_abi))
62 # endif
63 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
64 # define __stdcall __attribute__((pcs("aapcs-vfp")))
65 # else /* __i386__ */
66 # define __stdcall
67 # endif /* __i386__ */
68 #endif /* __stdcall */
70 #ifndef __cdecl
71 # if defined(__i386__) && defined(__GNUC__)
72 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
73 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
74 # else
75 # define __cdecl __attribute__((__cdecl__))
76 # endif
77 # elif defined(__x86_64__) && defined (__GNUC__)
78 # if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
79 # define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
80 # else
81 # define __cdecl __attribute__((ms_abi))
82 # endif
83 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
84 # define __cdecl __attribute__((pcs("aapcs-vfp")))
85 # elif !defined(_MSC_VER)
86 # define __cdecl
87 # endif
88 #endif /* __cdecl */
90 #ifndef __ms_va_list
91 # if defined(__x86_64__) && defined (__GNUC__)
92 # define __ms_va_list __builtin_ms_va_list
93 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
94 # define __ms_va_end(list) __builtin_ms_va_end(list)
95 # define __ms_va_copy(dest,src) __builtin_ms_va_copy(dest,src)
96 # else
97 # define __ms_va_list va_list
98 # define __ms_va_start(list,arg) va_start(list,arg)
99 # define __ms_va_end(list) va_end(list)
100 # ifdef va_copy
101 # define __ms_va_copy(dest,src) va_copy(dest,src)
102 # else
103 # define __ms_va_copy(dest,src) ((dest) = (src))
104 # endif
105 # endif
106 #endif
108 #ifndef WINAPIV
109 # if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
110 # define WINAPIV __attribute__((pcs("aapcs")))
111 # else
112 # define WINAPIV __cdecl
113 # endif
114 #endif
116 #ifndef DECLSPEC_ALIGN
117 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
118 # define DECLSPEC_ALIGN(x) __declspec(align(x))
119 # elif defined(__GNUC__)
120 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
121 # else
122 # define DECLSPEC_ALIGN(x)
123 # endif
124 #endif
126 #define _ARGMAX 100
128 #ifndef _MSVCRT_LONG_DEFINED
129 #define _MSVCRT_LONG_DEFINED
130 /* we need 32-bit longs even on 64-bit */
131 typedef int __msvcrt_long;
132 typedef unsigned int __msvcrt_ulong;
133 #endif
135 #ifndef _INTPTR_T_DEFINED
136 #ifdef _WIN64
137 typedef __int64 intptr_t;
138 #else
139 typedef int intptr_t;
140 #endif
141 #define _INTPTR_T_DEFINED
142 #endif
144 #ifndef _UINTPTR_T_DEFINED
145 #ifdef _WIN64
146 typedef unsigned __int64 uintptr_t;
147 #else
148 typedef unsigned int uintptr_t;
149 #endif
150 #define _UINTPTR_T_DEFINED
151 #endif
153 #ifndef _PTRDIFF_T_DEFINED
154 #ifdef _WIN64
155 typedef __int64 ptrdiff_t;
156 #else
157 typedef int ptrdiff_t;
158 #endif
159 #define _PTRDIFF_T_DEFINED
160 #endif
162 #ifndef _SIZE_T_DEFINED
163 #ifdef _WIN64
164 typedef unsigned __int64 size_t;
165 #else
166 typedef unsigned int size_t;
167 #endif
168 #define _SIZE_T_DEFINED
169 #endif
171 #ifndef _TIME32_T_DEFINED
172 typedef __msvcrt_long __time32_t;
173 #define _TIME32_T_DEFINED
174 #endif
176 #ifndef _TIME64_T_DEFINED
177 typedef __int64 DECLSPEC_ALIGN(8) __time64_t;
178 #define _TIME64_T_DEFINED
179 #endif
181 #ifdef _USE_32BIT_TIME_T
182 # ifdef _WIN64
183 # error You cannot use 32-bit time_t in Win64
184 # endif
185 #elif !defined(_WIN64)
186 # define _USE_32BIT_TIME_T
187 #endif
189 #ifndef _TIME_T_DEFINED
190 #ifdef _USE_32BIT_TIME_T
191 typedef __time32_t time_t;
192 #else
193 typedef __time64_t time_t;
194 #endif
195 #define _TIME_T_DEFINED
196 #endif
198 #ifndef _WCHAR_T_DEFINED
199 #ifndef __cplusplus
200 typedef unsigned short wchar_t;
201 #endif
202 #define _WCHAR_T_DEFINED
203 #endif
205 #ifndef _WCTYPE_T_DEFINED
206 typedef unsigned short wint_t;
207 typedef unsigned short wctype_t;
208 #define _WCTYPE_T_DEFINED
209 #endif
211 #ifndef _ERRNO_T_DEFINED
212 typedef int errno_t;
213 #define _ERRNO_T_DEFINED
214 #endif
216 struct threadlocaleinfostruct;
217 struct threadmbcinfostruct;
218 typedef struct threadlocaleinfostruct *pthreadlocinfo;
219 typedef struct threadmbcinfostruct *pthreadmbcinfo;
221 typedef struct localeinfo_struct
223 pthreadlocinfo locinfo;
224 pthreadmbcinfo mbcinfo;
225 } _locale_tstruct, *_locale_t;
227 #ifndef _TAGLC_ID_DEFINED
228 typedef struct tagLC_ID {
229 unsigned short wLanguage;
230 unsigned short wCountry;
231 unsigned short wCodePage;
232 } LC_ID, *LPLC_ID;
233 #define _TAGLC_ID_DEFINED
234 #endif
236 #ifndef _THREADLOCALEINFO
237 typedef struct threadlocaleinfostruct {
238 int refcount;
239 unsigned int lc_codepage;
240 unsigned int lc_collate_cp;
241 __msvcrt_ulong lc_handle[6];
242 LC_ID lc_id[6];
243 struct {
244 char *locale;
245 wchar_t *wlocale;
246 int *refcount;
247 int *wrefcount;
248 } lc_category[6];
249 int lc_clike;
250 int mb_cur_max;
251 int *lconv_intl_refcount;
252 int *lconv_num_refcount;
253 int *lconv_mon_refcount;
254 struct lconv *lconv;
255 int *ctype1_refcount;
256 unsigned short *ctype1;
257 const unsigned short *pctype;
258 const unsigned char *pclmap;
259 const unsigned char *pcumap;
260 struct __lc_time_data *lc_time_curr;
261 } threadlocinfo;
262 #define _THREADLOCALEINFO
263 #endif
265 #endif /* __WINE_CRTDEFS_H */