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