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

Last change on this file since 8706 was 8207, checked in by sandervl, 23 years ago

added

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