kernel32: Display correct parameters in comm traces.
[wine/gsoc_dplay.git] / include / msvcrt / stdlib.h
blob27e8dbef0cceecb467add51e6b135a274a08936a
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
10 #ifndef __WINE_USE_MSVCRT
11 #define __WINE_USE_MSVCRT
12 #endif
14 #include <pshpack8.h>
16 #ifndef NULL
17 #ifdef __cplusplus
18 #define NULL 0
19 #else
20 #define NULL ((void*)0)
21 #endif
22 #endif
24 #ifndef _WCHAR_T_DEFINED
25 #define _WCHAR_T_DEFINED
26 #ifndef __cplusplus
27 typedef unsigned short wchar_t;
28 #endif
29 #endif
31 #if !defined(_MSC_VER) && !defined(__int64)
32 #define __int64 long long
33 #endif
35 #define EXIT_SUCCESS 0
36 #define EXIT_FAILURE -1
37 #define RAND_MAX 0x7FFF
39 #ifndef _MAX_PATH
40 #define _MAX_DRIVE 3
41 #define _MAX_FNAME 256
42 #define _MAX_DIR _MAX_FNAME
43 #define _MAX_EXT _MAX_FNAME
44 #define _MAX_PATH 260
45 #endif
48 typedef struct _div_t {
49 int quot;
50 int rem;
51 } div_t;
53 typedef struct _ldiv_t {
54 long quot;
55 long rem;
56 } ldiv_t;
58 #ifndef _SIZE_T_DEFINED
59 #ifdef _WIN64
60 typedef unsigned __int64 size_t;
61 #else
62 typedef unsigned int size_t;
63 #endif
64 #define _SIZE_T_DEFINED
65 #endif
67 #define __max(a,b) (((a) > (b)) ? (a) : (b))
68 #define __min(a,b) (((a) < (b)) ? (a) : (b))
69 #ifndef __cplusplus
70 #define max(a,b) (((a) > (b)) ? (a) : (b))
71 #define min(a,b) (((a) < (b)) ? (a) : (b))
72 #endif
74 /* _set_error_mode() constants */
75 #define _OUT_TO_DEFAULT 0
76 #define _OUT_TO_STDERR 1
77 #define _OUT_TO_MSGBOX 2
78 #define _REPORT_ERRMODE 3
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
85 extern unsigned int* __p__osver(void);
86 extern unsigned int* __p__winver(void);
87 extern unsigned int* __p__winmajor(void);
88 extern unsigned int* __p__winminor(void);
89 #define _osver (*__p__osver())
90 #define _winver (*__p__winver())
91 #define _winmajor (*__p__winmajor())
92 #define _winminor (*__p__winminor())
94 extern int* __p___argc(void);
95 extern char*** __p___argv(void);
96 extern wchar_t*** __p___wargv(void);
97 extern char*** __p__environ(void);
98 extern wchar_t*** __p__wenviron(void);
99 extern int* __p___mb_cur_max(void);
100 extern unsigned long* __doserrno(void);
101 extern unsigned int* __p__fmode(void);
102 /* FIXME: We need functions to access these:
103 * int _sys_nerr;
104 * char** _sys_errlist;
106 #define __argc (*__p___argc())
107 #define __argv (*__p___argv())
108 #define __wargv (*__p___wargv())
109 #define _environ (*__p__environ())
110 #define _wenviron (*__p__wenviron())
111 #define __mb_cur_max (*__p___mb_cur_max())
112 #define _doserrno (*__doserrno())
113 #define _fmode (*_fmode)
116 extern int* _errno(void);
117 #define errno (*_errno())
120 typedef int (*_onexit_t)(void);
123 __int64 _atoi64(const char*);
124 long double _atold(const char*);
125 void _beep(unsigned int,unsigned int);
126 char* _ecvt(double,int,int*,int*);
127 char* _fcvt(double,int,int*,int*);
128 char* _fullpath(char*,const char*,size_t);
129 char* _gcvt(double,int,char*);
130 char* _i64toa(__int64,char*,int);
131 char* _itoa(int,char*,int);
132 char* _ltoa(long,char*,int);
133 unsigned long _lrotl(unsigned long,int);
134 unsigned long _lrotr(unsigned long,int);
135 void _makepath(char*,const char*,const char*,const char*,const char*);
136 size_t _mbstrlen(const char*);
137 _onexit_t _onexit(_onexit_t);
138 int _putenv(const char*);
139 unsigned int _rotl(unsigned int,int);
140 unsigned int _rotr(unsigned int,int);
141 void _searchenv(const char*,const char*,char*);
142 int _set_error_mode(int);
143 void _seterrormode(int);
144 void _sleep(unsigned long);
145 void _splitpath(const char*,char*,char*,char*,char*);
146 long double _strtold(const char*,char**);
147 void _swab(char*,char*,int);
148 char* _ui64toa(unsigned __int64,char*,int);
149 char* _ultoa(unsigned long,char*,int);
151 void _exit(int);
152 void abort(void);
153 int abs(int);
154 int atexit(void (*)(void));
155 double atof(const char*);
156 int atoi(const char*);
157 long atol(const char*);
158 void* calloc(size_t,size_t);
159 #ifndef __i386__
160 div_t div(int,int);
161 ldiv_t ldiv(long,long);
162 #endif
163 void exit(int);
164 void free(void*);
165 char* getenv(const char*);
166 long labs(long);
167 void* malloc(size_t);
168 int mblen(const char*,size_t);
169 void perror(const char*);
170 int rand(void);
171 void* realloc(void*,size_t);
172 void srand(unsigned int);
173 double strtod(const char*,char**);
174 long strtol(const char*,char**,int);
175 unsigned long strtoul(const char*,char**,int);
176 int system(const char*);
177 void* bsearch(const void*,const void*,size_t,size_t,
178 int (*)(const void*,const void*));
179 void qsort(void*,size_t,size_t,
180 int (*)(const void*,const void*));
182 #ifndef _WSTDLIB_DEFINED
183 #define _WSTDLIB_DEFINED
184 wchar_t*_itow(int,wchar_t*,int);
185 wchar_t*_i64tow(__int64,wchar_t*,int);
186 wchar_t*_ltow(long,wchar_t*,int);
187 wchar_t*_ui64tow(unsigned __int64,wchar_t*,int);
188 wchar_t*_ultow(unsigned long,wchar_t*,int);
189 wchar_t*_wfullpath(wchar_t*,const wchar_t*,size_t);
190 wchar_t*_wgetenv(const wchar_t*);
191 void _wmakepath(wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*);
192 void _wperror(const wchar_t*);
193 int _wputenv(const wchar_t*);
194 void _wsearchenv(const wchar_t*,const wchar_t*,wchar_t*);
195 void _wsplitpath(const wchar_t*,wchar_t*,wchar_t*,wchar_t*,wchar_t*);
196 int _wsystem(const wchar_t*);
197 int _wtoi(const wchar_t*);
198 __int64 _wtoi64(const wchar_t*);
199 long _wtol(const wchar_t*);
201 size_t mbstowcs(wchar_t*,const char*,size_t);
202 int mbtowc(wchar_t*,const char*,size_t);
203 double wcstod(const wchar_t*,wchar_t**);
204 long wcstol(const wchar_t*,wchar_t**,int);
205 size_t wcstombs(char*,const wchar_t*,size_t);
206 unsigned long wcstoul(const wchar_t*,wchar_t**,int);
207 int wctomb(char*,wchar_t);
208 #endif /* _WSTDLIB_DEFINED */
210 #ifdef __cplusplus
212 #endif
215 #define environ _environ
216 #define onexit_t _onexit_t
218 static inline char* ecvt(double value, int ndigit, int* decpt, int* sign) { return _ecvt(value, ndigit, decpt, sign); }
219 static inline char* fcvt(double value, int ndigit, int* decpt, int* sign) { return _fcvt(value, ndigit, decpt, sign); }
220 static inline char* gcvt(double value, int ndigit, char* buf) { return _gcvt(value, ndigit, buf); }
221 static inline char* itoa(int value, char* str, int radix) { return _itoa(value, str, radix); }
222 static inline char* ltoa(long value, char* str, int radix) { return _ltoa(value, str, radix); }
223 static inline _onexit_t onexit(_onexit_t func) { return _onexit(func); }
224 static inline int putenv(const char* str) { return _putenv(str); }
225 static inline void swab(char* src, char* dst, int len) { _swab(src, dst, len); }
226 static inline char* ultoa(unsigned long value, char* str, int radix) { return _ultoa(value, str, radix); }
228 #ifdef __i386__
229 static inline div_t __wine_msvcrt_div(int num, int denom)
231 extern unsigned __int64 div(int,int);
232 div_t ret;
233 unsigned __int64 res = div(num,denom);
234 ret.quot = (int)res;
235 ret.rem = (int)(res >> 32);
236 return ret;
238 static inline ldiv_t __wine_msvcrt_ldiv(long num, long denom)
240 extern unsigned __int64 ldiv(long,long);
241 ldiv_t ret;
242 unsigned __int64 res = ldiv(num,denom);
243 ret.quot = (long)res;
244 ret.rem = (long)(res >> 32);
245 return ret;
247 #define div(num,denom) __wine_msvcrt_div(num,denom)
248 #define ldiv(num,denom) __wine_msvcrt_ldiv(num,denom)
249 #endif
251 #include <poppack.h>
253 #endif /* __WINE_STDLIB_H */