dplayx: Code to send CreatePlayer messages
[wine/gsoc_dplay.git] / include / msvcrt / stdlib.h
blob2531f73b5f6ecf157653898a1723183d18df3d12
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
51 typedef struct _div_t {
52 int quot;
53 int rem;
54 } div_t;
56 typedef struct _ldiv_t {
57 __msvcrt_long quot;
58 __msvcrt_long rem;
59 } ldiv_t;
61 #define __max(a,b) (((a) > (b)) ? (a) : (b))
62 #define __min(a,b) (((a) < (b)) ? (a) : (b))
63 #ifndef __cplusplus
64 #define max(a,b) (((a) > (b)) ? (a) : (b))
65 #define min(a,b) (((a) < (b)) ? (a) : (b))
66 #endif
68 /* _set_error_mode() constants */
69 #define _OUT_TO_DEFAULT 0
70 #define _OUT_TO_STDERR 1
71 #define _OUT_TO_MSGBOX 2
72 #define _REPORT_ERRMODE 3
75 #ifdef __cplusplus
76 extern "C" {
77 #endif
79 #ifdef __i386__
81 extern unsigned int* __cdecl __p__osver(void);
82 #define _osver (*__p__osver())
83 extern unsigned int* __cdecl __p__winver(void);
84 #define _winver (*__p__winver())
85 extern unsigned int* __cdecl __p__winmajor(void);
86 #define _winmajor (*__p__winmajor())
87 extern unsigned int* __cdecl __p__winminor(void);
88 #define _winminor (*__p__winminor())
89 extern int* __cdecl __p___argc(void);
90 #define __argc (*__p___argc())
91 extern char*** __cdecl __p___argv(void);
92 #define __argv (*__p___argv())
93 extern wchar_t*** __cdecl __p___wargv(void);
94 #define __wargv (*__p___wargv())
95 extern char*** __cdecl __p__environ(void);
96 #define _environ (*__p__environ())
97 extern wchar_t*** __cdecl __p__wenviron(void);
98 #define _wenviron (*__p__wenviron())
99 extern unsigned int* __cdecl __p__fmode(void);
100 #define _fmode (*__p__fmode())
102 #else /* __i386__ */
104 extern unsigned int _osver;
105 extern unsigned int _winver;
106 extern unsigned int _winmajor;
107 extern unsigned int _winminor;
108 extern int __argc;
109 extern char **__argv;
110 extern wchar_t **__wargv;
111 extern char **_environ;
112 extern wchar_t **_wenviron;
113 extern unsigned int _fmode;
115 #endif /* __i386__ */
117 extern int* __cdecl ___mb_cur_max_func(void);
118 #define __mb_cur_max (*___mb_cur_max_func())
119 extern __msvcrt_ulong* __cdecl __doserrno(void);
120 #define _doserrno (*__doserrno())
121 extern int* __cdecl _errno(void);
122 #define errno (*_errno())
124 /* FIXME: We need functions to access these:
125 * int _sys_nerr;
126 * char** _sys_errlist;
130 typedef int (__cdecl *_onexit_t)(void);
133 int __cdecl _atodbl(_CRT_DOUBLE*,char*);
134 int __cdecl _atoflt(_CRT_FLOAT*,char*);
135 __int64 __cdecl _atoi64(const char*);
136 long double __cdecl _atold(const char*);
137 int __cdecl _atoldbl(_LDOUBLE*,char*);
138 void __cdecl _beep(unsigned int,unsigned int);
139 char* __cdecl _ecvt(double,int,int*,int*);
140 char* __cdecl _fcvt(double,int,int*,int*);
141 char* __cdecl _fullpath(char*,const char*,size_t);
142 char* __cdecl _gcvt(double,int,char*);
143 char* __cdecl _i64toa(__int64,char*,int);
144 char* __cdecl _itoa(int,char*,int);
145 char* __cdecl _ltoa(__msvcrt_long,char*,int);
146 __msvcrt_ulong __cdecl _lrotl(__msvcrt_ulong,int);
147 __msvcrt_ulong __cdecl _lrotr(__msvcrt_ulong,int);
148 void __cdecl _makepath(char*,const char*,const char*,const char*,const char*);
149 size_t __cdecl _mbstrlen(const char*);
150 _onexit_t __cdecl _onexit(_onexit_t);
151 int __cdecl _putenv(const char*);
152 unsigned int __cdecl _rotl(unsigned int,int);
153 unsigned int __cdecl _rotr(unsigned int,int);
154 void __cdecl _searchenv(const char*,const char*,char*);
155 int __cdecl _set_error_mode(int);
156 void __cdecl _seterrormode(int);
157 void __cdecl _sleep(__msvcrt_ulong);
158 void __cdecl _splitpath(const char*,char*,char*,char*,char*);
159 long double __cdecl _strtold(const char*,char**);
160 void __cdecl _swab(char*,char*,int);
161 char* __cdecl _ui64toa(unsigned __int64,char*,int);
162 char* __cdecl _ultoa(__msvcrt_ulong,char*,int);
164 void __cdecl _exit(int);
165 void __cdecl abort(void);
166 int __cdecl abs(int);
167 int __cdecl atexit(void (*)(void));
168 double __cdecl atof(const char*);
169 int __cdecl atoi(const char*);
170 __msvcrt_long __cdecl atol(const char*);
171 void* __cdecl calloc(size_t,size_t);
172 #ifndef __i386__
173 div_t __cdecl div(int,int);
174 ldiv_t __cdecl ldiv(__msvcrt_long,__msvcrt_long);
175 #endif
176 void __cdecl exit(int);
177 void __cdecl free(void*);
178 char* __cdecl getenv(const char*);
179 __msvcrt_long __cdecl labs(__msvcrt_long);
180 void* __cdecl malloc(size_t);
181 int __cdecl mblen(const char*,size_t);
182 void __cdecl perror(const char*);
183 int __cdecl rand(void);
184 void* __cdecl realloc(void*,size_t);
185 void __cdecl srand(unsigned int);
186 double __cdecl strtod(const char*,char**);
187 __msvcrt_long __cdecl strtol(const char*,char**,int);
188 __msvcrt_ulong __cdecl strtoul(const char*,char**,int);
189 int __cdecl system(const char*);
190 void* __cdecl bsearch(const void*,const void*,size_t,size_t,int (*)(const void*,const void*));
191 void __cdecl qsort(void*,size_t,size_t,int (*)(const void*,const void*));
193 #ifndef _WSTDLIB_DEFINED
194 #define _WSTDLIB_DEFINED
195 wchar_t* __cdecl _itow(int,wchar_t*,int);
196 wchar_t* __cdecl _i64tow(__int64,wchar_t*,int);
197 wchar_t* __cdecl _ltow(__msvcrt_long,wchar_t*,int);
198 wchar_t* __cdecl _ui64tow(unsigned __int64,wchar_t*,int);
199 wchar_t* __cdecl _ultow(__msvcrt_ulong,wchar_t*,int);
200 wchar_t* __cdecl _wfullpath(wchar_t*,const wchar_t*,size_t);
201 wchar_t* __cdecl _wgetenv(const wchar_t*);
202 void __cdecl _wmakepath(wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*);
203 void __cdecl _wperror(const wchar_t*);
204 int __cdecl _wputenv(const wchar_t*);
205 void __cdecl _wsearchenv(const wchar_t*,const wchar_t*,wchar_t*);
206 void __cdecl _wsplitpath(const wchar_t*,wchar_t*,wchar_t*,wchar_t*,wchar_t*);
207 int __cdecl _wsystem(const wchar_t*);
208 int __cdecl _wtoi(const wchar_t*);
209 __int64 __cdecl _wtoi64(const wchar_t*);
210 __msvcrt_long __cdecl _wtol(const wchar_t*);
212 size_t __cdecl mbstowcs(wchar_t*,const char*,size_t);
213 int __cdecl mbtowc(wchar_t*,const char*,size_t);
214 double __cdecl wcstod(const wchar_t*,wchar_t**);
215 __msvcrt_long __cdecl wcstol(const wchar_t*,wchar_t**,int);
216 size_t __cdecl wcstombs(char*,const wchar_t*,size_t);
217 __msvcrt_ulong __cdecl wcstoul(const wchar_t*,wchar_t**,int);
218 int __cdecl wctomb(char*,wchar_t);
219 #endif /* _WSTDLIB_DEFINED */
221 #ifdef __cplusplus
223 #endif
226 #define environ _environ
227 #define onexit_t _onexit_t
229 static inline char* ecvt(double value, int ndigit, int* decpt, int* sign) { return _ecvt(value, ndigit, decpt, sign); }
230 static inline char* fcvt(double value, int ndigit, int* decpt, int* sign) { return _fcvt(value, ndigit, decpt, sign); }
231 static inline char* gcvt(double value, int ndigit, char* buf) { return _gcvt(value, ndigit, buf); }
232 static inline char* itoa(int value, char* str, int radix) { return _itoa(value, str, radix); }
233 static inline char* ltoa(__msvcrt_long value, char* str, int radix) { return _ltoa(value, str, radix); }
234 static inline _onexit_t onexit(_onexit_t func) { return _onexit(func); }
235 static inline int putenv(const char* str) { return _putenv(str); }
236 static inline void swab(char* src, char* dst, int len) { _swab(src, dst, len); }
237 static inline char* ultoa(__msvcrt_ulong value, char* str, int radix) { return _ultoa(value, str, radix); }
239 #ifdef __i386__
240 static inline div_t __wine_msvcrt_div(int num, int denom)
242 extern unsigned __int64 div(int,int);
243 div_t ret;
244 unsigned __int64 res = div(num,denom);
245 ret.quot = (int)res;
246 ret.rem = (int)(res >> 32);
247 return ret;
249 static inline ldiv_t __wine_msvcrt_ldiv(__msvcrt_long num, __msvcrt_long denom)
251 extern unsigned __int64 ldiv(__msvcrt_long,__msvcrt_long);
252 ldiv_t ret;
253 unsigned __int64 res = ldiv(num,denom);
254 ret.quot = (__msvcrt_long)res;
255 ret.rem = (__msvcrt_long)(res >> 32);
256 return ret;
258 #define div(num,denom) __wine_msvcrt_div(num,denom)
259 #define ldiv(num,denom) __wine_msvcrt_ldiv(num,denom)
260 #endif
262 #include <poppack.h>
264 #endif /* __WINE_STDLIB_H */