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