ReactOS 0.4.16-dev-2104-gb84fa49
corecrt.h
Go to the documentation of this file.
1/*
2 * CRT definitions
3 *
4 * Copyright 2000 Francois Gouget.
5 *
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.
10 *
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.
15 *
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
19 */
20
21#ifndef __WINE_CORECRT_H
22#define __WINE_CORECRT_H
23
24#ifndef __WINE_USE_MSVCRT
25#define __WINE_USE_MSVCRT
26#endif
27
28#ifdef __WINE_CONFIG_H
29# error You cannot use config.h with msvcrt
30#endif
31
32#ifdef WINE_UNIX_LIB
33# error msvcrt headers cannot be used in Unix code
34#endif
35
36#ifndef _WIN32
37# define _WIN32
38#endif
39
40#ifndef WIN32
41# define WIN32
42#endif
43
44#if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
45#define _WIN64
46#endif
47
48#ifndef _MSVCR_VER
49# define _MSVCR_VER 140
50#endif
51
52#if !defined(_UCRT) && _MSVCR_VER >= 140
53# define _UCRT
54#endif
55
56#include <sal.h>
57
58#ifndef _MSC_VER
59# ifndef __int8
60# define __int8 char
61# endif
62# ifndef __int16
63# define __int16 short
64# endif
65# ifndef __int32
66# define __int32 int
67# endif
68# ifndef __int64
69# if defined(_WIN64) && !defined(__MINGW64__)
70# define __int64 long
71# else
72# define __int64 long long
73# endif
74# endif
75#endif
76
77#ifndef NULL
78#ifdef __cplusplus
79#ifndef _WIN64
80#define NULL 0
81#else
82#define NULL 0LL
83#endif
84#else
85#define NULL ((void *)0)
86#endif
87#endif
88
89#ifndef __has_attribute
90#define __has_attribute(x) 0
91#endif
92
93#ifndef __has_declspec_attribute
94# if defined(_MSC_VER)
95# define __has_declspec_attribute(x) 1
96# else
97# define __has_declspec_attribute(x) 0
98# endif
99#endif
100
101#if !defined(_MSC_VER) && !defined(__MINGW32__)
102# undef __stdcall
103# undef __cdecl
104# if defined(__i386__) && defined(__GNUC__)
105# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
106# define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
107# define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
108# else
109# define __stdcall __attribute__((__stdcall__))
110# define __cdecl __attribute__((__cdecl__))
111# endif
112# elif defined(__x86_64__) && defined(__GNUC__)
113# if __has_attribute(__force_align_arg_pointer__)
114# define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
115# else
116# define __stdcall __attribute__((ms_abi))
117# endif
118# define __cdecl __stdcall
119# else
120# define __stdcall
121# define __cdecl
122# endif
123#endif /* _MSC_VER || __MINGW32__ */
124
125#ifndef DECLSPEC_NORETURN
126# ifdef __GNUC__
127# define DECLSPEC_NORETURN __attribute__((noreturn))
128# elif __has_declspec_attribute(noreturn) && !defined(MIDL_PASS)
129# define DECLSPEC_NORETURN __declspec(noreturn)
130# else
131# define DECLSPEC_NORETURN
132# endif
133#endif
134
135#ifndef DECLSPEC_ALIGN
136# ifdef __GNUC__
137# define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
138# elif __has_declspec_attribute(align) && !defined(MIDL_PASS)
139# define DECLSPEC_ALIGN(x) __declspec(align(x))
140# else
141# define DECLSPEC_ALIGN(x)
142# endif
143#endif
144
145#ifndef _ACRTIMP
146# ifdef _CRTIMP
147# define _ACRTIMP _CRTIMP
148# elif __has_declspec_attribute(dllimport)
149# define _ACRTIMP __declspec(dllimport)
150# elif defined(__MINGW32__) || defined(__CYGWIN__)
151# define _ACRTIMP __attribute__((dllimport))
152# else
153# define _ACRTIMP
154# endif
155#endif
156
157#define _ARGMAX 100
158#define _CRT_INT_MAX 0x7fffffff
159
160#ifndef _MSVCRT_LONG_DEFINED
161#define _MSVCRT_LONG_DEFINED
162/* we need 32-bit longs even on 64-bit */
163#ifdef __LP64__
164typedef int __msvcrt_long;
165typedef unsigned int __msvcrt_ulong;
166#else
167typedef long __msvcrt_long;
168typedef unsigned long __msvcrt_ulong;
169#endif
170#endif
171
172#ifndef _INTPTR_T_DEFINED
173#ifdef _WIN64
174typedef __int64 intptr_t;
175#else
176typedef int intptr_t;
177#endif
178#define _INTPTR_T_DEFINED
179#endif
180
181#ifndef _UINTPTR_T_DEFINED
182#ifdef _WIN64
183typedef unsigned __int64 uintptr_t;
184#else
185typedef unsigned int uintptr_t;
186#endif
187#define _UINTPTR_T_DEFINED
188#endif
189
190#ifndef _PTRDIFF_T_DEFINED
191#ifdef _WIN64
192typedef __int64 ptrdiff_t;
193#else
194typedef int ptrdiff_t;
195#endif
196#define _PTRDIFF_T_DEFINED
197#endif
198
199#ifndef _SIZE_T_DEFINED
200#ifdef _WIN64
201typedef unsigned __int64 size_t;
202#else
203typedef unsigned int size_t;
204#endif
205#define _SIZE_T_DEFINED
206#endif
207
208#ifndef _TIME32_T_DEFINED
210#define _TIME32_T_DEFINED
211#endif
212
213#ifndef _TIME64_T_DEFINED
215#define _TIME64_T_DEFINED
216#endif
217
218#ifdef _USE_32BIT_TIME_T
219# ifdef _WIN64
220# error You cannot use 32-bit time_t in Win64
221# endif
222#elif !defined(_WIN64)
223# define _USE_32BIT_TIME_T
224#endif
225
226#ifndef _TIME_T_DEFINED
227#ifdef _USE_32BIT_TIME_T
229#else
230typedef __time64_t time_t;
231#endif
232#define _TIME_T_DEFINED
233#endif
234
235#ifndef _WCHAR_T_DEFINED
236#ifndef __cplusplus
237typedef unsigned short wchar_t;
238#endif
239#define _WCHAR_T_DEFINED
240#endif
241
242#ifndef _WCTYPE_T_DEFINED
243typedef unsigned short wint_t;
244typedef unsigned short wctype_t;
245#define _WCTYPE_T_DEFINED
246#endif
247
248#ifndef _ERRNO_T_DEFINED
249typedef int errno_t;
250#define _ERRNO_T_DEFINED
251#endif
252
257
258typedef struct localeinfo_struct
259{
263
264#ifndef _TAGLC_ID_DEFINED
265typedef struct tagLC_ID {
266 unsigned short wLanguage;
267 unsigned short wCountry;
268 unsigned short wCodePage;
270#define _TAGLC_ID_DEFINED
271#endif
272
273#ifndef _THREADLOCALEINFO
275#if _MSVCR_VER >= 140
276 unsigned short *pctype;
278 unsigned int lc_codepage;
279#endif
280
282#if _MSVCR_VER < 140
283 unsigned int lc_codepage;
284#endif
285 unsigned int lc_collate_cp;
288 struct {
289 char *locale;
290 wchar_t *wlocale;
295#if _MSVCR_VER < 140
296 int mb_cur_max;
297#endif
301 struct lconv *lconv;
303 unsigned short *ctype1;
304#if _MSVCR_VER < 140
305 unsigned short *pctype;
306#endif
307 const unsigned char *pclmap;
308 const unsigned char *pcumap;
310#if _MSVCR_VER >= 110
311 wchar_t *lc_name[6];
312#endif
314#define _THREADLOCALEINFO
315#endif
316
317#if defined(__MINGW32__) || (defined(_MSC_VER) && defined(__clang__))
318#define __WINE_CRT_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
319#define __WINE_CRT_SCANF_ATTR(fmt,args) __attribute__((format (scanf,fmt,args)))
320#else
321#define __WINE_CRT_PRINTF_ATTR(fmt,args)
322#define __WINE_CRT_SCANF_ATTR(fmt,args)
323#endif
324
325#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
326#define __WINE_ALLOC_SIZE(...) __attribute__((__alloc_size__(__VA_ARGS__)))
327#else
328#define __WINE_ALLOC_SIZE(...)
329#endif
330
331#if defined(__GNUC__) && (__GNUC__ > 10)
332#define __WINE_DEALLOC(...) __attribute__((malloc (__VA_ARGS__)))
333#else
334#define __WINE_DEALLOC(...)
335#endif
336
337#if defined(__GNUC__) && (__GNUC__ > 2)
338#define __WINE_MALLOC __attribute__((malloc))
339#else
340#define __WINE_MALLOC
341#endif
342
343#endif /* __WINE_CORECRT_H */
__msvcrt_long __time32_t
Definition: corecrt.h:209
int errno_t
Definition: corecrt.h:249
struct tagLC_ID LC_ID
int intptr_t
Definition: corecrt.h:176
struct threadlocaleinfostruct threadlocinfo
#define DECLSPEC_ALIGN(x)
Definition: corecrt.h:141
long __msvcrt_long
Definition: corecrt.h:167
struct threadlocaleinfostruct * pthreadlocinfo
Definition: corecrt.h:255
struct threadmbcinfostruct * pthreadmbcinfo
Definition: corecrt.h:256
struct localeinfo_struct _locale_tstruct
struct tagLC_ID * LPLC_ID
unsigned int uintptr_t
Definition: corecrt.h:185
unsigned int size_t
Definition: corecrt.h:203
unsigned short wchar_t
Definition: corecrt.h:237
unsigned short wint_t
Definition: corecrt.h:243
unsigned short wctype_t
Definition: corecrt.h:244
#define __int64
Definition: corecrt.h:72
struct localeinfo_struct * _locale_t
Definition: string.c:106
__time32_t time_t
Definition: corecrt.h:228
int ptrdiff_t
Definition: corecrt.h:194
unsigned long __msvcrt_ulong
Definition: corecrt.h:168
__int64 __time64_t
Definition: corecrt.h:619
Definition: locale.h:37
pthreadlocinfo locinfo
Definition: corecrt.h:260
pthreadmbcinfo mbcinfo
Definition: corecrt.h:261
unsigned short wCountry
Definition: corecrt.h:267
unsigned short wLanguage
Definition: corecrt.h:266
unsigned short wCodePage
Definition: corecrt.h:268
struct lconv * lconv
Definition: corecrt.h:301
unsigned int lc_collate_cp
Definition: corecrt.h:285
unsigned int lc_codepage
Definition: corecrt.h:278
struct threadlocaleinfostruct::@576 lc_category[6]
unsigned short * ctype1
Definition: corecrt.h:303
wchar_t * lc_name[6]
Definition: corecrt.h:311
struct __lc_time_data * lc_time_curr
Definition: corecrt.h:309
unsigned short * pctype
Definition: corecrt.h:276
const unsigned char * pcumap
Definition: corecrt.h:308
const unsigned char * pclmap
Definition: corecrt.h:307
__msvcrt_ulong lc_handle[6]
Definition: corecrt.h:286