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

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

PF: header updates

File size: 6.7 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);
88extern unsigned long* __doserrno(void);
89extern unsigned int* __p__fmode(void);
90/* FIXME: We need functions to access these:
91 * int _sys_nerr;
92 * char** _sys_errlist;
93 */
94#ifndef USE_MSVCRT_PREFIX
95#define __argc (*__p___argc())
96#define __argv (*__p___argv())
97#define __wargv (*__p___wargv())
98#define _environ (*__p__environ())
99#define _wenviron (*__p__wenviron())
100#define __mb_cur_max (*__p___mb_cur_max())
101#define _doserrno (*__doserrno())
102#define _fmode (*_fmode)
103#elif !defined(__WINE__)
104#define MSVCRT___argc (*__p___argc())
105#define MSVCRT___argv (*__p___argv())
106#define MSVCRT___wargv (*__p___wargv())
107#define MSVCRT__environ (*__p__environ())
108#define MSVCRT__wenviron (*__p__wenviron())
109#define MSVCRT___mb_cur_max (*__p___mb_cur_max())
110#define MSVCRT__doserrno (*__doserrno())
111#define MSVCRT__fmode (*_fmode())
112#endif /* USE_MSVCRT_PREFIX, __WINE__ */
113
114
115extern int* MSVCRT(_errno)(void);
116#ifndef USE_MSVCRT_PREFIX
117#define errno (*_errno())
118#elif !defined(__WINE__)
119#define MSVCRT_errno (*MSVCRT__errno())
120#endif /* USE_MSVCRT_PREFIX, __WINE__ */
121
122
123typedef int (*_onexit_t)(void);
124
125
126__int64 _atoi64(const char*);
127long double _atold(const char*);
128void _beep(unsigned int,unsigned int);
129char* _ecvt(double,int,int*,int*);
130char* _fcvt(double,int,int*,int*);
131char* _fullpath(char*,const char*,MSVCRT(size_t));
132char* _gcvt(double,int,char*);
133char* _i64toa(__int64,char*,int);
134char* _itoa(int,char*,int);
135char* _ltoa(long,char*,int);
136unsigned long _lrotl(unsigned long,int);
137unsigned long _lrotr(unsigned long,int);
138void _makepath(char*,const char*,const char*,const char*,const char*);
139MSVCRT(size_t) _mbstrlen(const char*);
140_onexit_t _onexit(_onexit_t);
141int _putenv(const char*);
142unsigned int _rotl(unsigned int,int);
143unsigned int _rotr(unsigned int,int);
144void _searchenv(const char*,const char*,char*);
145int _set_error_mode(int);
146void _seterrormode(int);
147void _sleep(unsigned long);
148void _splitpath(const char*,char*,char*,char*,char*);
149long double _strtold(const char*,char**);
150void _swab(char*,char*,int);
151char* _ui64toa(unsigned __int64,char*,int);
152char* _ultoa(unsigned long,char*,int);
153
154void MSVCRT(_exit)(int);
155void MSVCRT(abort)();
156int MSVCRT(abs)(int);
157int MSVCRT(atexit)(void (*)(void));
158double MSVCRT(atof)(const char*);
159int MSVCRT(atoi)(const char*);
160long MSVCRT(atol)(const char*);
161#ifdef __i386__
162long long MSVCRT(div)(int,int);
163unsigned long long MSVCRT(ldiv)(long,long);
164#else
165MSVCRT(div_t) MSVCRT(div)(int,int);
166MSVCRT(ldiv_t) MSVCRT(ldiv)(long,long);
167#endif
168void MSVCRT(exit)(int);
169char* MSVCRT(getenv)(const char*);
170long MSVCRT(labs)(long);
171int MSVCRT(mblen)(const char*,MSVCRT(size_t));
172void MSVCRT(perror)(const char*);
173int MSVCRT(rand)(void);
174void MSVCRT(srand)(unsigned int);
175double MSVCRT(strtod)(const char*,char**);
176long MSVCRT(strtol)(const char*,char**,int);
177unsigned long MSVCRT(strtoul)(const char*,char**,int);
178int MSVCRT(system)(const char*);
179
180WCHAR* _itow(int,WCHAR*,int);
181WCHAR* _i64tow(__int64,WCHAR*,int);
182WCHAR* _ltow(long,WCHAR*,int);
183WCHAR* _ui64tow(unsigned __int64,WCHAR*,int);
184WCHAR* _ultow(unsigned long,WCHAR*,int);
185WCHAR* _wfullpath(WCHAR*,const WCHAR*,MSVCRT(size_t));
186WCHAR* _wgetenv(const WCHAR*);
187void _wmakepath(WCHAR*,const WCHAR*,const WCHAR*,const WCHAR*,const WCHAR*);
188void _wperror(const WCHAR*);
189int _wputenv(const WCHAR*);
190void _wsearchenv(const WCHAR*,const WCHAR*,WCHAR*);
191void _wsplitpath(const WCHAR*,WCHAR*,WCHAR*,WCHAR*,WCHAR*);
192int _wsystem(const WCHAR*);
193int _wtoi(const WCHAR*);
194__int64 _wtoi64(const WCHAR*);
195long _wtol(const WCHAR*);
196
197MSVCRT(size_t) MSVCRT(mbstowcs)(WCHAR*,const char*,MSVCRT(size_t));
198int MSVCRT(mbtowc)(WCHAR*,const char*,MSVCRT(size_t));
199double MSVCRT(wcstod)(const WCHAR*,WCHAR**);
200long MSVCRT(wcstol)(const WCHAR*,WCHAR**,int);
201MSVCRT(size_t) MSVCRT(wcstombs)(char*,const WCHAR*,MSVCRT(size_t));
202unsigned long MSVCRT(wcstoul)(const WCHAR*,WCHAR**,int);
203int MSVCRT(wctomb)(char*,WCHAR);
204
205#ifdef __cplusplus
206}
207#endif
208
209
210#ifndef USE_MSVCRT_PREFIX
211#define environ _environ
212#define onexit_t _onexit_t
213
214#define ecvt _ecvt
215#define fcvt _fcvt
216#define gcvt _gcvt
217#define itoa _itoa
218#define ltoa _ltoa
219#define onexit _onexit
220#define putenv _putenv
221#define swab _swab
222#define ultoa _ultoa
223#endif /* USE_MSVCRT_PREFIX */
224
225#endif /* __WINE_STDLIB_H */
Note: See TracBrowser for help on using the repository browser.