source: trunk/include/win/msvcrt/stdlib.h@ 10367

Last change on this file since 10367 was 10004, checked in by sandervl, 22 years ago

PF: Header updates

File size: 6.8 KB
Line 
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#define __WINE_USE_MSVCRT
11
12#include "winnt.h"
13#include "msvcrt/malloc.h" /* For size_t, malloc & co */
14#include "msvcrt/search.h" /* For bsearch and qsort */
15
16
17#ifndef USE_MSVCRT_PREFIX
18#define EXIT_SUCCESS 0
19#define EXIT_FAILURE -1
20#define RAND_MAX 0x7FFF
21#else
22#define MSVCRT_RAND_MAX 0x7FFF
23#endif /* USE_MSVCRT_PREFIX */
24
25#ifndef _MAX_PATH
26#define _MAX_DRIVE 3
27#define _MAX_FNAME 256
28
29#ifndef _MAX_DIR
30#define _MAX_DIR _MAX_FNAME
31#endif
32
33#ifndef _MAX_EXT
34#define _MAX_EXT _MAX_FNAME
35#endif
36
37#define _MAX_PATH 260
38#endif
39
40
41typedef struct MSVCRT(_div_t) {
42 int quot;
43 int rem;
44} MSVCRT(div_t);
45
46typedef struct MSVCRT(_ldiv_t) {
47 long quot;
48 long rem;
49} MSVCRT(ldiv_t);
50
51
52#ifdef __min /* watcom stdlib.h defines this */
53#undef __min
54#endif
55
56#ifdef __max /* watcom stdlib.h defines this */
57#undef __max
58#endif
59
60#define __max(a,b) (((a) > (b)) ? (a) : (b))
61#define __min(a,b) (((a) < (b)) ? (a) : (b))
62
63#ifndef __cplusplus
64#define max(a,b) (((a) > (b)) ? (a) : (b))
65#define min(a,b) (((a) < (b)) ? (a) : (b))
66#endif
67
68
69#ifdef __cplusplus
70extern "C" {
71#endif
72
73extern unsigned int* __p__osver();
74extern unsigned int* __p__winver();
75extern unsigned int* __p__winmajor();
76extern unsigned int* __p__winminor();
77#define _osver (*__p__osver())
78#define _winver (*__p__winver())
79#define _winmajor (*__p__winmajor())
80#define _winminor (*__p__winminor())
81
82extern int* __p___argc(void);
83extern char*** __p___argv(void);
84extern WCHAR*** __p___wargv(void);
85extern char*** __p__environ(void);
86extern WCHAR*** __p__wenviron(void);
87extern int* __p___mb_cur_max(void);
88#ifndef __WIN32OS2__
89extern unsigned long* __doserrno(void);
90#else
91extern unsigned long* MSVCRT_doserrno(void);
92#endif
93extern unsigned int* __p__fmode(void);
94/* FIXME: We need functions to access these:
95 * int _sys_nerr;
96 * char** _sys_errlist;
97 */
98#ifndef USE_MSVCRT_PREFIX
99#define __argc (*__p___argc())
100#define __argv (*__p___argv())
101#define __wargv (*__p___wargv())
102#define _environ (*__p__environ())
103#define _wenviron (*__p__wenviron())
104#define __mb_cur_max (*__p___mb_cur_max())
105#define _doserrno (*__doserrno())
106#define _fmode (*_fmode)
107#elif !defined(__WINE__)
108#define MSVCRT___argc (*__p___argc())
109#define MSVCRT___argv (*__p___argv())
110#define MSVCRT___wargv (*__p___wargv())
111#define MSVCRT__environ (*__p__environ())
112#define MSVCRT__wenviron (*__p__wenviron())
113#define MSVCRT___mb_cur_max (*__p___mb_cur_max())
114#define MSVCRT__doserrno (*__doserrno())
115#define MSVCRT__fmode (*_fmode())
116#endif /* USE_MSVCRT_PREFIX, __WINE__ */
117
118
119extern int* MSVCRT(_errno)(void);
120#ifndef USE_MSVCRT_PREFIX
121#define errno (*_errno())
122#elif !defined(__WINE__)
123#define MSVCRT_errno (*MSVCRT__errno())
124#endif /* USE_MSVCRT_PREFIX, __WINE__ */
125
126
127typedef int (*_onexit_t)(void);
128
129
130__int64 _atoi64(const char*);
131long double _atold(const char*);
132void _beep(unsigned int,unsigned int);
133char* _ecvt(double,int,int*,int*);
134char* _fcvt(double,int,int*,int*);
135char* MSVCRT(_fullpath)(char*,const char*,MSVCRT(size_t));
136char* _gcvt(double,int,char*);
137char* _i64toa(__int64,char*,int);
138char* _itoa(int,char*,int);
139char* _ltoa(long,char*,int);
140unsigned long MSVCRT(_lrotl)(unsigned long,int);
141unsigned long MSVCRT(_lrotr)(unsigned long,int);
142void _makepath(char*,const char*,const char*,const char*,const char*);
143MSVCRT(size_t) _mbstrlen(const char*);
144_onexit_t MSVCRT_onexit(_onexit_t);
145int _putenv(const char*);
146unsigned int _rotl(unsigned int,int);
147unsigned int _rotr(unsigned int,int);
148void MSVCRT(_searchenv)(const char*,const char*,char*);
149int _set_error_mode(int);
150void _seterrormode(int);
151void MSVCRT(_sleep)(unsigned long);
152void _splitpath(const char*,char*,char*,char*,char*);
153long double _strtold(const char*,char**);
154void MSVCRT(_swab)(char*,char*,int);
155char* _ui64toa(unsigned __int64,char*,int);
156char* _ultoa(unsigned long,char*,int);
157
158void MSVCRT(_exit)(int);
159void MSVCRT(abort)();
160int MSVCRT(abs)(int);
161int MSVCRT(atexit)(void (*)(void));
162double MSVCRT(atof)(const char*);
163int MSVCRT(atoi)(const char*);
164long MSVCRT(atol)(const char*);
165#ifdef __i386__
166long long MSVCRT(div)(int,int);
167unsigned long long MSVCRT(ldiv)(long,long);
168#else
169MSVCRT(div_t) MSVCRT(div)(int,int);
170MSVCRT(ldiv_t) MSVCRT(ldiv)(long,long);
171#endif
172void MSVCRT(exit)(int);
173char* MSVCRT(getenv)(const char*);
174long MSVCRT(labs)(long);
175int MSVCRT(mblen)(const char*,MSVCRT(size_t));
176void MSVCRT(perror)(const char*);
177int MSVCRT(rand)(void);
178void MSVCRT(srand)(unsigned int);
179double MSVCRT(strtod)(const char*,char**);
180long MSVCRT(strtol)(const char*,char**,int);
181unsigned long MSVCRT(strtoul)(const char*,char**,int);
182int MSVCRT(system)(const char*);
183
184WCHAR* _itow(int,WCHAR*,int);
185WCHAR* _i64tow(__int64,WCHAR*,int);
186WCHAR* _ltow(long,WCHAR*,int);
187WCHAR* _ui64tow(unsigned __int64,WCHAR*,int);
188WCHAR* _ultow(unsigned long,WCHAR*,int);
189WCHAR* _wfullpath(WCHAR*,const WCHAR*,MSVCRT(size_t));
190WCHAR* _wgetenv(const WCHAR*);
191void _wmakepath(WCHAR*,const WCHAR*,const WCHAR*,const WCHAR*,const WCHAR*);
192void _wperror(const WCHAR*);
193int _wputenv(const WCHAR*);
194void _wsearchenv(const WCHAR*,const WCHAR*,WCHAR*);
195void _wsplitpath(const WCHAR*,WCHAR*,WCHAR*,WCHAR*,WCHAR*);
196int _wsystem(const WCHAR*);
197int _wtoi(const WCHAR*);
198__int64 _wtoi64(const WCHAR*);
199long _wtol(const WCHAR*);
200
201MSVCRT(size_t) MSVCRT(mbstowcs)(WCHAR*,const char*,MSVCRT(size_t));
202int MSVCRT(mbtowc)(WCHAR*,const char*,MSVCRT(size_t));
203double MSVCRT(wcstod)(const WCHAR*,WCHAR**);
204long MSVCRT(wcstol)(const WCHAR*,WCHAR**,int);
205MSVCRT(size_t) MSVCRT(wcstombs)(char*,const WCHAR*,MSVCRT(size_t));
206unsigned long MSVCRT(wcstoul)(const WCHAR*,WCHAR**,int);
207int MSVCRT(wctomb)(char*,WCHAR);
208
209#ifdef __cplusplus
210}
211#endif
212
213
214#ifndef USE_MSVCRT_PREFIX
215#define environ _environ
216#define onexit_t _onexit_t
217
218#define ecvt _ecvt
219#define fcvt _fcvt
220#define gcvt _gcvt
221#define itoa _itoa
222#define ltoa _ltoa
223#define onexit _onexit
224#define putenv _putenv
225#define swab _swab
226#define ultoa _ultoa
227#endif /* USE_MSVCRT_PREFIX */
228
229#endif /* __WINE_STDLIB_H */
Note: See TracBrowser for help on using the repository browser.