windowscodecs: Implement TiffDecoder_GetResolution.
[wine/multimedia.git] / include / msvcrt / stdlib.h
blob6a6398d0fd67c954aff1a80ee3e9f1f7848fb909
1 /*
2 * Standard library definitions
4 * Derived from the mingw header written by Colin Peters.
5 * Modified for Wine use by Jon Griffiths and Francois Gouget.
6 * This file is in the public domain.
7 */
8 #ifndef __WINE_STDLIB_H
9 #define __WINE_STDLIB_H
11 #include <crtdefs.h>
13 #include <pshpack8.h>
15 #ifndef NULL
16 #ifdef __cplusplus
17 #define NULL 0
18 #else
19 #define NULL ((void*)0)
20 #endif
21 #endif
23 typedef struct
25 float f;
26 } _CRT_FLOAT;
28 typedef struct
30 double x;
31 } _CRT_DOUBLE;
33 typedef struct
35 unsigned char ld[10];
36 } _LDOUBLE;
38 #define EXIT_SUCCESS 0
39 #define EXIT_FAILURE -1
40 #define RAND_MAX 0x7FFF
42 #ifndef _MAX_PATH
43 #define _MAX_DRIVE 3
44 #define _MAX_FNAME 256
45 #define _MAX_DIR _MAX_FNAME
46 #define _MAX_EXT _MAX_FNAME
47 #define _MAX_PATH 260
48 #endif
50 /* Make the secure string functions (names end in "_s") truncate their output */
51 #define _TRUNCATE ((size_t)-1)
53 typedef struct _div_t {
54 int quot;
55 int rem;
56 } div_t;
58 typedef struct _ldiv_t {
59 __msvcrt_long quot;
60 __msvcrt_long rem;
61 } ldiv_t;
63 #define __max(a,b) (((a) > (b)) ? (a) : (b))
64 #define __min(a,b) (((a) < (b)) ? (a) : (b))
65 #ifndef __cplusplus
66 #define max(a,b) (((a) > (b)) ? (a) : (b))
67 #define min(a,b) (((a) < (b)) ? (a) : (b))
68 #endif
70 /* _set_error_mode() constants */
71 #define _OUT_TO_DEFAULT 0
72 #define _OUT_TO_STDERR 1
73 #define _OUT_TO_MSGBOX 2
74 #define _REPORT_ERRMODE 3
76 /* _set_abort_behavior codes */
77 #define _WRITE_ABORT_MSG 1
78 #define _CALL_REPORTFAULT 2
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
84 #ifdef __i386__
86 extern unsigned int* __cdecl __p__osver(void);
87 #define _osver (*__p__osver())
88 extern unsigned int* __cdecl __p__winver(void);
89 #define _winver (*__p__winver())
90 extern unsigned int* __cdecl __p__winmajor(void);
91 #define _winmajor (*__p__winmajor())
92 extern unsigned int* __cdecl __p__winminor(void);
93 #define _winminor (*__p__winminor())
94 extern int* __cdecl __p___argc(void);
95 #define __argc (*__p___argc())
96 extern char*** __cdecl __p___argv(void);
97 #define __argv (*__p___argv())
98 extern wchar_t*** __cdecl __p___wargv(void);
99 #define __wargv (*__p___wargv())
100 extern char*** __cdecl __p__environ(void);
101 #define _environ (*__p__environ())
102 extern wchar_t*** __cdecl __p__wenviron(void);
103 #define _wenviron (*__p__wenviron())
104 extern unsigned int* __cdecl __p__fmode(void);
105 #define _fmode (*__p__fmode())
107 #else /* __i386__ */
109 extern unsigned int _osver;
110 extern unsigned int _winver;
111 extern unsigned int _winmajor;
112 extern unsigned int _winminor;
113 extern int __argc;
114 extern char **__argv;
115 extern wchar_t **__wargv;
116 extern char **_environ;
117 extern wchar_t **_wenviron;
118 extern unsigned int _fmode;
120 #endif /* __i386__ */
122 extern int* __cdecl ___mb_cur_max_func(void);
123 #define __mb_cur_max (*___mb_cur_max_func())
124 extern __msvcrt_ulong* __cdecl __doserrno(void);
125 #define _doserrno (*__doserrno())
126 extern int* __cdecl _errno(void);
127 #define errno (*_errno())
129 /* FIXME: We need functions to access these:
130 * int _sys_nerr;
131 * char** _sys_errlist;
134 errno_t __cdecl _get_doserrno(int*);
135 errno_t __cdecl _get_errno(int*);
136 errno_t __cdecl _set_doserrno(int);
137 errno_t __cdecl _set_errno(int);
139 typedef int (__cdecl *_onexit_t)(void);
142 int __cdecl _atodbl(_CRT_DOUBLE*,char*);
143 int __cdecl _atoflt(_CRT_FLOAT*,char*);
144 int __cdecl _atoflt_l(_CRT_FLOAT*,char*,_locale_t);
145 __int64 __cdecl _atoi64(const char*);
146 long double __cdecl _atold(const char*);
147 int __cdecl _atoldbl(_LDOUBLE*,char*);
148 void __cdecl _beep(unsigned int,unsigned int);
149 char* __cdecl _ecvt(double,int,int*,int*);
150 char* __cdecl _fcvt(double,int,int*,int*);
151 char* __cdecl _fullpath(char*,const char*,size_t);
152 char* __cdecl _gcvt(double,int,char*);
153 char* __cdecl _i64toa(__int64,char*,int);
154 char* __cdecl _itoa(int,char*,int);
155 errno_t __cdecl _itoa_s(int,char*,size_t,int);
156 char* __cdecl _ltoa(__msvcrt_long,char*,int);
157 __msvcrt_ulong __cdecl _lrotl(__msvcrt_ulong,int);
158 __msvcrt_ulong __cdecl _lrotr(__msvcrt_ulong,int);
159 void __cdecl _makepath(char*,const char*,const char*,const char*,const char*);
160 int __cdecl _makepath_s(char*,size_t,const char*,const char*,const char*,const char*);
161 size_t __cdecl _mbstrlen(const char*);
162 _onexit_t __cdecl _onexit(_onexit_t);
163 int __cdecl _putenv(const char*);
164 unsigned int __cdecl _rotl(unsigned int,int);
165 unsigned int __cdecl _rotr(unsigned int,int);
166 void __cdecl _searchenv(const char*,const char*,char*);
167 int __cdecl _set_error_mode(int);
168 void __cdecl _seterrormode(int);
169 void __cdecl _sleep(__msvcrt_ulong);
170 void __cdecl _splitpath(const char*,char*,char*,char*,char*);
171 long double __cdecl _strtold(const char*,char**);
172 void __cdecl _swab(char*,char*,int);
173 char* __cdecl _ui64toa(unsigned __int64,char*,int);
174 errno_t __cdecl _ui64toa_s(unsigned __int64,char*,size_t,int);
175 char* __cdecl _ultoa(__msvcrt_ulong,char*,int);
176 errno_t __cdecl _ultoa_s(__msvcrt_ulong,char*,size_t,int);
178 void __cdecl _exit(int);
179 void __cdecl abort(void);
180 int __cdecl abs(int);
181 int __cdecl atexit(void (*)(void));
182 double __cdecl atof(const char*);
183 int __cdecl atoi(const char*);
184 __msvcrt_long __cdecl atol(const char*);
185 void* __cdecl calloc(size_t,size_t);
186 #ifndef __i386__
187 div_t __cdecl div(int,int);
188 ldiv_t __cdecl ldiv(__msvcrt_long,__msvcrt_long);
189 #endif
190 void __cdecl exit(int);
191 void __cdecl free(void*);
192 char* __cdecl getenv(const char*);
193 __msvcrt_long __cdecl labs(__msvcrt_long);
194 void* __cdecl malloc(size_t);
195 int __cdecl mblen(const char*,size_t);
196 void __cdecl perror(const char*);
197 int __cdecl rand(void);
198 errno_t __cdecl rand_s(unsigned int*);
199 void* __cdecl realloc(void*,size_t);
200 void __cdecl srand(unsigned int);
201 double __cdecl strtod(const char*,char**);
202 __msvcrt_long __cdecl strtol(const char*,char**,int);
203 __msvcrt_ulong __cdecl strtoul(const char*,char**,int);
204 int __cdecl system(const char*);
205 void* __cdecl bsearch(const void*,const void*,size_t,size_t,int (*)(const void*,const void*));
206 void __cdecl qsort(void*,size_t,size_t,int (*)(const void*,const void*));
208 #ifndef _WSTDLIB_DEFINED
209 #define _WSTDLIB_DEFINED
210 wchar_t* __cdecl _itow(int,wchar_t*,int);
211 wchar_t* __cdecl _i64tow(__int64,wchar_t*,int);
212 wchar_t* __cdecl _ltow(__msvcrt_long,wchar_t*,int);
213 wchar_t* __cdecl _ui64tow(unsigned __int64,wchar_t*,int);
214 wchar_t* __cdecl _ultow(__msvcrt_ulong,wchar_t*,int);
215 wchar_t* __cdecl _wfullpath(wchar_t*,const wchar_t*,size_t);
216 wchar_t* __cdecl _wgetenv(const wchar_t*);
217 void __cdecl _wmakepath(wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*);
218 int __cdecl _wmakepath_s(wchar_t*,size_t,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*);
219 void __cdecl _wperror(const wchar_t*);
220 int __cdecl _wputenv(const wchar_t*);
221 void __cdecl _wsearchenv(const wchar_t*,const wchar_t*,wchar_t*);
222 void __cdecl _wsplitpath(const wchar_t*,wchar_t*,wchar_t*,wchar_t*,wchar_t*);
223 errno_t __cdecl _wsplitpath_s(const wchar_t*,wchar_t*,size_t,wchar_t*,size_t,
224 wchar_t*,size_t,wchar_t*,size_t);
225 int __cdecl _wsystem(const wchar_t*);
226 double __cdecl _wtof(const wchar_t*);
227 int __cdecl _wtoi(const wchar_t*);
228 __int64 __cdecl _wtoi64(const wchar_t*);
229 __msvcrt_long __cdecl _wtol(const wchar_t*);
231 size_t __cdecl mbstowcs(wchar_t*,const char*,size_t);
232 errno_t __cdecl mbstowcs_s(size_t*,wchar_t*,size_t,const char*,size_t);
233 int __cdecl mbtowc(wchar_t*,const char*,size_t);
234 double __cdecl wcstod(const wchar_t*,wchar_t**);
235 __msvcrt_long __cdecl wcstol(const wchar_t*,wchar_t**,int);
236 size_t __cdecl wcstombs(char*,const wchar_t*,size_t);
237 errno_t __cdecl wcstombs_s(size_t*,char*,size_t,const wchar_t*,size_t);
238 __msvcrt_ulong __cdecl wcstoul(const wchar_t*,wchar_t**,int);
239 int __cdecl wctomb(char*,wchar_t);
240 #endif /* _WSTDLIB_DEFINED */
242 typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t*, const wchar_t*, const wchar_t*, unsigned, uintptr_t);
243 _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler);
244 _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void);
245 void __cdecl _invalid_parameter(const wchar_t *expr, const wchar_t *func, const wchar_t *file,
246 unsigned int line, uintptr_t arg);
248 #ifdef __cplusplus
250 #endif
253 #define environ _environ
254 #define onexit_t _onexit_t
256 static inline char* ecvt(double value, int ndigit, int* decpt, int* sign) { return _ecvt(value, ndigit, decpt, sign); }
257 static inline char* fcvt(double value, int ndigit, int* decpt, int* sign) { return _fcvt(value, ndigit, decpt, sign); }
258 static inline char* gcvt(double value, int ndigit, char* buf) { return _gcvt(value, ndigit, buf); }
259 static inline char* itoa(int value, char* str, int radix) { return _itoa(value, str, radix); }
260 static inline char* ltoa(__msvcrt_long value, char* str, int radix) { return _ltoa(value, str, radix); }
261 static inline _onexit_t onexit(_onexit_t func) { return _onexit(func); }
262 static inline int putenv(const char* str) { return _putenv(str); }
263 static inline void swab(char* src, char* dst, int len) { _swab(src, dst, len); }
264 static inline char* ultoa(__msvcrt_ulong value, char* str, int radix) { return _ultoa(value, str, radix); }
266 #ifdef __i386__
267 static inline div_t __wine_msvcrt_div(int num, int denom)
269 extern unsigned __int64 div(int,int);
270 div_t ret;
271 unsigned __int64 res = div(num,denom);
272 ret.quot = (int)res;
273 ret.rem = (int)(res >> 32);
274 return ret;
276 static inline ldiv_t __wine_msvcrt_ldiv(__msvcrt_long num, __msvcrt_long denom)
278 extern unsigned __int64 ldiv(__msvcrt_long,__msvcrt_long);
279 ldiv_t ret;
280 unsigned __int64 res = ldiv(num,denom);
281 ret.quot = (__msvcrt_long)res;
282 ret.rem = (__msvcrt_long)(res >> 32);
283 return ret;
285 #define div(num,denom) __wine_msvcrt_div(num,denom)
286 #define ldiv(num,denom) __wine_msvcrt_ldiv(num,denom)
287 #endif
289 #include <poppack.h>
291 #endif /* __WINE_STDLIB_H */