Alexandre Julliard | 33fa6c2 | 2008-12-11 22:37:34 +0100 | [diff] [blame] | 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 | |
Nikolay Sivov | ad6bc94 | 2011-01-18 19:06:07 +0300 | [diff] [blame] | 21 | #ifndef __WINE_CRTDEFS_H |
| 22 | #define __WINE_CRTDEFS_H |
| 23 | |
Alexandre Julliard | 33fa6c2 | 2008-12-11 22:37:34 +0100 | [diff] [blame] | 24 | #ifndef __WINE_USE_MSVCRT |
| 25 | #define __WINE_USE_MSVCRT |
| 26 | #endif |
| 27 | |
Alexandre Julliard | 8f1ea6e | 2010-07-22 17:40:55 +0200 | [diff] [blame] | 28 | #ifdef __WINE_WINE_PORT_H |
| 29 | # error You cannot use both wine/port.h and msvcrt headers |
| 30 | #endif |
| 31 | |
Alexandre Julliard | 33fa6c2 | 2008-12-11 22:37:34 +0100 | [diff] [blame] | 32 | #if defined(__x86_64__) && !defined(_WIN64) |
| 33 | #define _WIN64 |
| 34 | #endif |
| 35 | |
| 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 |
| 43 | |
| 44 | #ifndef __stdcall |
| 45 | # ifdef __i386__ |
| 46 | # ifdef __GNUC__ |
| 47 | # ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */ |
| 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 | # define __stdcall __attribute__((ms_abi)) |
| 59 | # else |
| 60 | # define __stdcall |
| 61 | # endif |
| 62 | #endif /* __stdcall */ |
| 63 | |
| 64 | #ifndef __cdecl |
| 65 | # if defined(__i386__) && defined(__GNUC__) |
| 66 | # ifdef __APPLE__ /* Mac OS X uses 16-byte aligned stack and not a 4-byte one */ |
| 67 | # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__)) |
| 68 | # else |
| 69 | # define __cdecl __attribute__((__cdecl__)) |
| 70 | # endif |
| 71 | # elif defined(__x86_64__) && defined (__GNUC__) |
| 72 | # define __cdecl __attribute__((ms_abi)) |
| 73 | # elif !defined(_MSC_VER) |
| 74 | # define __cdecl |
| 75 | # endif |
| 76 | #endif /* __cdecl */ |
| 77 | |
Alexandre Julliard | 3ad7f77 | 2009-01-06 21:09:58 +0100 | [diff] [blame] | 78 | #ifndef __ms_va_list |
| 79 | # if defined(__x86_64__) && defined (__GNUC__) |
| 80 | # define __ms_va_list __builtin_ms_va_list |
| 81 | # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg) |
| 82 | # define __ms_va_end(list) __builtin_ms_va_end(list) |
| 83 | # else |
| 84 | # define __ms_va_list va_list |
| 85 | # define __ms_va_start(list,arg) va_start(list,arg) |
| 86 | # define __ms_va_end(list) va_end(list) |
| 87 | # endif |
| 88 | #endif |
| 89 | |
Alexandre Julliard | 7f69436 | 2009-11-21 14:23:22 +0100 | [diff] [blame] | 90 | #ifndef DECLSPEC_ALIGN |
| 91 | # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS) |
| 92 | # define DECLSPEC_ALIGN(x) __declspec(align(x)) |
| 93 | # elif defined(__GNUC__) |
| 94 | # define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) |
| 95 | # else |
| 96 | # define DECLSPEC_ALIGN(x) |
| 97 | # endif |
| 98 | #endif |
| 99 | |
Piotr Caban | 00182ca | 2011-04-27 12:09:01 +0200 | [diff] [blame^] | 100 | #define _ARGMAX 100 |
| 101 | |
Alexandre Julliard | 580e07e | 2009-05-23 11:38:59 +0200 | [diff] [blame] | 102 | #ifndef _MSVCRT_LONG_DEFINED |
| 103 | #define _MSVCRT_LONG_DEFINED |
| 104 | /* we need 32-bit longs even on 64-bit */ |
| 105 | typedef int __msvcrt_long; |
| 106 | typedef unsigned int __msvcrt_ulong; |
| 107 | #endif |
| 108 | |
Alexandre Julliard | 33fa6c2 | 2008-12-11 22:37:34 +0100 | [diff] [blame] | 109 | #ifndef _INTPTR_T_DEFINED |
| 110 | #ifdef _WIN64 |
| 111 | typedef __int64 intptr_t; |
| 112 | #else |
| 113 | typedef int intptr_t; |
| 114 | #endif |
| 115 | #define _INTPTR_T_DEFINED |
| 116 | #endif |
| 117 | |
| 118 | #ifndef _UINTPTR_T_DEFINED |
| 119 | #ifdef _WIN64 |
| 120 | typedef unsigned __int64 uintptr_t; |
| 121 | #else |
| 122 | typedef unsigned int uintptr_t; |
| 123 | #endif |
| 124 | #define _UINTPTR_T_DEFINED |
| 125 | #endif |
| 126 | |
| 127 | #ifndef _PTRDIFF_T_DEFINED |
| 128 | #ifdef _WIN64 |
| 129 | typedef __int64 ptrdiff_t; |
| 130 | #else |
| 131 | typedef int ptrdiff_t; |
| 132 | #endif |
| 133 | #define _PTRDIFF_T_DEFINED |
| 134 | #endif |
| 135 | |
| 136 | #ifndef _SIZE_T_DEFINED |
| 137 | #ifdef _WIN64 |
| 138 | typedef unsigned __int64 size_t; |
| 139 | #else |
| 140 | typedef unsigned int size_t; |
| 141 | #endif |
| 142 | #define _SIZE_T_DEFINED |
| 143 | #endif |
| 144 | |
Alexandre Julliard | 33fa6c2 | 2008-12-11 22:37:34 +0100 | [diff] [blame] | 145 | #ifndef _TIME32_T_DEFINED |
Alexandre Julliard | 580e07e | 2009-05-23 11:38:59 +0200 | [diff] [blame] | 146 | typedef __msvcrt_long __time32_t; |
Alexandre Julliard | 33fa6c2 | 2008-12-11 22:37:34 +0100 | [diff] [blame] | 147 | #define _TIME32_T_DEFINED |
| 148 | #endif |
| 149 | |
| 150 | #ifndef _TIME64_T_DEFINED |
Alexandre Julliard | 7f69436 | 2009-11-21 14:23:22 +0100 | [diff] [blame] | 151 | typedef __int64 DECLSPEC_ALIGN(8) __time64_t; |
Alexandre Julliard | 33fa6c2 | 2008-12-11 22:37:34 +0100 | [diff] [blame] | 152 | #define _TIME64_T_DEFINED |
| 153 | #endif |
| 154 | |
Alexandre Julliard | 8408e3a | 2009-05-23 11:06:29 +0200 | [diff] [blame] | 155 | #ifdef _USE_32BIT_TIME_T |
| 156 | # ifdef _WIN64 |
| 157 | # error You cannot use 32-bit time_t in Win64 |
| 158 | # endif |
| 159 | #elif !defined(_WIN64) |
| 160 | # define _USE_32BIT_TIME_T |
| 161 | #endif |
| 162 | |
Alexandre Julliard | fcd2ff9 | 2009-01-04 14:10:43 +0100 | [diff] [blame] | 163 | #ifndef _TIME_T_DEFINED |
Alexandre Julliard | 8408e3a | 2009-05-23 11:06:29 +0200 | [diff] [blame] | 164 | #ifdef _USE_32BIT_TIME_T |
Alexandre Julliard | fcd2ff9 | 2009-01-04 14:10:43 +0100 | [diff] [blame] | 165 | typedef __time32_t time_t; |
Alexandre Julliard | 8408e3a | 2009-05-23 11:06:29 +0200 | [diff] [blame] | 166 | #else |
| 167 | typedef __time64_t time_t; |
Alexandre Julliard | fcd2ff9 | 2009-01-04 14:10:43 +0100 | [diff] [blame] | 168 | #endif |
| 169 | #define _TIME_T_DEFINED |
| 170 | #endif |
| 171 | |
Alexandre Julliard | 33fa6c2 | 2008-12-11 22:37:34 +0100 | [diff] [blame] | 172 | #ifndef _WCHAR_T_DEFINED |
| 173 | #ifndef __cplusplus |
| 174 | typedef unsigned short wchar_t; |
| 175 | #endif |
| 176 | #define _WCHAR_T_DEFINED |
| 177 | #endif |
| 178 | |
| 179 | #ifndef _WCTYPE_T_DEFINED |
| 180 | typedef unsigned short wint_t; |
| 181 | typedef unsigned short wctype_t; |
| 182 | #define _WCTYPE_T_DEFINED |
| 183 | #endif |
Alexander Scott-Johns | 5361263 | 2010-06-16 22:42:49 +0100 | [diff] [blame] | 184 | |
| 185 | #ifndef _ERRNO_T_DEFINED |
| 186 | typedef int errno_t; |
| 187 | #define _ERRNO_T_DEFINED |
| 188 | #endif |
Nikolay Sivov | ad6bc94 | 2011-01-18 19:06:07 +0300 | [diff] [blame] | 189 | |
| 190 | struct threadlocaleinfostruct; |
| 191 | struct threadmbcinfostruct; |
| 192 | typedef struct threadlocaleinfostruct *pthreadlocinfo; |
| 193 | typedef struct threadmbcinfostruct *pthreadmbcinfo; |
| 194 | |
| 195 | typedef struct localeinfo_struct |
| 196 | { |
| 197 | pthreadlocinfo locinfo; |
| 198 | pthreadmbcinfo mbcinfo; |
| 199 | } _locale_tstruct, *_locale_t; |
| 200 | |
| 201 | #ifndef _TAGLC_ID_DEFINED |
| 202 | typedef struct tagLC_ID { |
| 203 | unsigned short wLanguage; |
| 204 | unsigned short wCountry; |
| 205 | unsigned short wCodePage; |
| 206 | } LC_ID, *LPLC_ID; |
| 207 | #define _TAGLC_ID_DEFINED |
| 208 | #endif |
| 209 | |
| 210 | #ifndef _THREADLOCALEINFO |
| 211 | typedef struct threadlocaleinfostruct { |
| 212 | int refcount; |
| 213 | unsigned int lc_codepage; |
| 214 | unsigned int lc_collate_cp; |
| 215 | unsigned long lc_handle[6]; |
| 216 | LC_ID lc_id[6]; |
| 217 | struct { |
| 218 | char *locale; |
| 219 | wchar_t *wlocale; |
| 220 | int *refcount; |
| 221 | int *wrefcount; |
| 222 | } lc_category[6]; |
| 223 | int lc_clike; |
| 224 | int mb_cur_max; |
| 225 | int *lconv_intl_refcount; |
| 226 | int *lconv_num_refcount; |
| 227 | int *lconv_mon_refcount; |
| 228 | struct lconv *lconv; |
| 229 | int *ctype1_refcount; |
| 230 | unsigned short *ctype1; |
| 231 | const unsigned short *pctype; |
| 232 | const unsigned char *pclmap; |
| 233 | const unsigned char *pcumap; |
| 234 | struct __lc_time_data *lc_time_curr; |
| 235 | } threadlocinfo; |
| 236 | #define _THREADLOCALEINFO |
| 237 | #endif |
| 238 | |
| 239 | #endif /* __WINE_CRTDEFS_H */ |