OSDN Git Service

2011-05-24 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
[pf3gnuchains/pf3gnuchains4x.git] / winsup / mingw / include / stdlib.h
1 /*
2  * stdlib.h
3  * This file has no copyright assigned and is placed in the Public Domain.
4  * This file is a part of the mingw-runtime package.
5  * No warranty is given; refer to the file DISCLAIMER within the package.
6  *
7  * Definitions for common types, variables, and functions.
8  *
9  */
10
11 #ifndef _STDLIB_H_
12 #define _STDLIB_H_
13
14 /* All the headers include this file. */
15 #include <_mingw.h>
16
17 #define __need_size_t
18 #define __need_wchar_t
19 #define __need_NULL
20 #ifndef RC_INVOKED
21 #include <stddef.h>
22 #endif /* RC_INVOKED */
23
24 /*
25  * RAND_MAX is the maximum value that may be returned by rand.
26  * The minimum is zero.
27  */
28 #define RAND_MAX        0x7FFF
29
30 /*
31  * These values may be used as exit status codes.
32  */
33 #define EXIT_SUCCESS    0
34 #define EXIT_FAILURE    1
35
36 /*
37  * Definitions for path name functions.
38  * NOTE: All of these values have simply been chosen to be conservatively high.
39  *       Remember that with long file names we can no longer depend on
40  *       extensions being short.
41  */
42 #ifndef __STRICT_ANSI__
43
44 #ifndef MAX_PATH
45 #define MAX_PATH        (260)
46 #endif
47
48 #define _MAX_PATH       MAX_PATH
49 #define _MAX_DRIVE      (3)
50 #define _MAX_DIR        256
51 #define _MAX_FNAME      256
52 #define _MAX_EXT        256
53
54 #endif  /* Not __STRICT_ANSI__ */
55
56
57 #ifndef RC_INVOKED
58
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62
63 #if !defined (__STRICT_ANSI__)
64
65 /*
66  * This seems like a convenient place to declare these variables, which
67  * give programs using WinMain (or main for that matter) access to main-ish
68  * argc and argv. environ is a pointer to a table of environment variables.
69  * NOTE: Strings in _argv and environ are ANSI strings.
70  */
71 extern int      _argc;
72 extern char**   _argv;
73
74 /* imports from runtime dll of the above variables */
75 #ifdef __MSVCRT__
76
77 extern int*  __cdecl __MINGW_NOTHROW   __p___argc(void);
78 extern char*** __cdecl __MINGW_NOTHROW  __p___argv(void);
79 extern wchar_t***  __cdecl __MINGW_NOTHROW __p___wargv(void);
80
81 #define __argc (*__p___argc())
82 #define __argv (*__p___argv())
83 #define __wargv (*__p___wargv())
84
85 #else /* !MSVCRT */
86
87 #ifndef __DECLSPEC_SUPPORTED
88
89 extern int*    _imp____argc_dll;
90 extern char***  _imp____argv_dll;
91 #define __argc (*_imp____argc_dll)
92 #define __argv (*_imp____argv_dll)
93
94 #else /* __DECLSPEC_SUPPORTED */
95
96 __MINGW_IMPORT int    __argc_dll;
97 __MINGW_IMPORT char**  __argv_dll;
98 #define __argc __argc_dll
99 #define __argv __argv_dll
100
101 #endif /* __DECLSPEC_SUPPORTED */
102
103 #endif /* __MSVCRT */
104 #endif /* __STRICT_ANSI__ */
105 /*
106  * Also defined in ctype.h.
107  */
108 #ifndef MB_CUR_MAX
109 #ifdef __DECLSPEC_SUPPORTED
110 # ifdef __MSVCRT__
111 #  define MB_CUR_MAX __mb_cur_max
112    __MINGW_IMPORT int __mb_cur_max;
113 # else          /* not __MSVCRT */
114 #  define MB_CUR_MAX __mb_cur_max_dll
115    __MINGW_IMPORT int __mb_cur_max_dll;
116 # endif         /* not __MSVCRT */
117
118 #else           /* ! __DECLSPEC_SUPPORTED */
119 # ifdef __MSVCRT__
120    extern int* _imp____mb_cur_max;
121 #  define MB_CUR_MAX (*_imp____mb_cur_max)
122 # else          /* not __MSVCRT */
123    extern int*  _imp____mb_cur_max_dll;
124 #  define MB_CUR_MAX (*_imp____mb_cur_max_dll)
125 # endif         /* not __MSVCRT */
126 #endif          /*  __DECLSPEC_SUPPORTED */
127 #endif  /* MB_CUR_MAX */
128
129 /* 
130  * MS likes to declare errno in stdlib.h as well. 
131  */
132
133 #ifdef _UWIN
134 #undef errno
135 extern int errno;
136 #else
137  _CRTIMP int* __cdecl __MINGW_NOTHROW   _errno(void);
138 #define errno           (*_errno())
139 #endif
140  _CRTIMP int* __cdecl __MINGW_NOTHROW   __doserrno(void);
141 #define _doserrno       (*__doserrno())
142
143 #if !defined (__STRICT_ANSI__)
144 /*
145  * Use environ from the DLL, not as a global. 
146  */
147
148 #ifdef __MSVCRT__
149   extern _CRTIMP char *** __cdecl __MINGW_NOTHROW __p__environ(void);
150   extern _CRTIMP wchar_t *** __cdecl __MINGW_NOTHROW  __p__wenviron(void);
151 # define _environ (*__p__environ())
152 # define _wenviron (*__p__wenviron())
153 #else /* ! __MSVCRT__ */
154 # ifndef __DECLSPEC_SUPPORTED
155     extern char *** _imp___environ_dll;
156 #   define _environ (*_imp___environ_dll)
157 # else /* __DECLSPEC_SUPPORTED */
158     __MINGW_IMPORT char ** _environ_dll;
159 #   define _environ _environ_dll
160 # endif /* __DECLSPEC_SUPPORTED */
161 #endif /* ! __MSVCRT__ */
162
163 #define environ _environ
164
165 #ifdef  __MSVCRT__
166 /* One of the MSVCRTxx libraries */
167
168 #ifndef __DECLSPEC_SUPPORTED
169   extern int*   _imp___sys_nerr;
170 # define        sys_nerr        (*_imp___sys_nerr)
171 #else /* __DECLSPEC_SUPPORTED */
172   __MINGW_IMPORT int    _sys_nerr;
173 # ifndef _UWIN
174 #   define      sys_nerr        _sys_nerr
175 # endif /* _UWIN */
176 #endif /* __DECLSPEC_SUPPORTED */
177
178 #else /* ! __MSVCRT__ */
179
180 /* CRTDLL run time library */
181
182 #ifndef __DECLSPEC_SUPPORTED
183   extern int*   _imp___sys_nerr_dll;
184 # define sys_nerr       (*_imp___sys_nerr_dll)
185 #else /* __DECLSPEC_SUPPORTED */
186   __MINGW_IMPORT int    _sys_nerr_dll;
187 # define sys_nerr       _sys_nerr_dll
188 #endif /* __DECLSPEC_SUPPORTED */
189
190 #endif /* ! __MSVCRT__ */
191
192 #ifndef __DECLSPEC_SUPPORTED
193 extern char***  _imp__sys_errlist;
194 #define sys_errlist     (*_imp___sys_errlist)
195 #else /* __DECLSPEC_SUPPORTED */
196 __MINGW_IMPORT char*    _sys_errlist[];
197 #ifndef _UWIN
198 #define sys_errlist     _sys_errlist
199 #endif /* _UWIN */
200 #endif /* __DECLSPEC_SUPPORTED */
201
202 /*
203  * OS version and such constants.
204  */
205
206 #ifdef  __MSVCRT__
207 /* msvcrtxx.dll */
208
209 extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int*    __p__osver(void);
210 extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int*    __p__winver(void);
211 extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int*    __p__winmajor(void);
212 extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int*    __p__winminor(void);
213
214 #ifndef __DECLSPEC_SUPPORTED
215 # define _osver         (*__p__osver())
216 # define _winver        (*__p__winver())
217 # define _winmajor      (*__p__winmajor())
218 # define _winminor      (*__p__winminor())
219 #else
220 __MINGW_IMPORT unsigned int _osver;
221 __MINGW_IMPORT unsigned int _winver;
222 __MINGW_IMPORT unsigned int _winmajor;
223 __MINGW_IMPORT unsigned int _winminor;
224 #endif /* __DECLSPEC_SUPPORTED */
225
226 #else
227 /* Not msvcrtxx.dll, thus crtdll.dll */
228
229 #ifndef __DECLSPEC_SUPPORTED
230
231 extern unsigned int*    _imp___osver_dll;
232 extern unsigned int*    _imp___winver_dll;
233 extern unsigned int*    _imp___winmajor_dll;
234 extern unsigned int*    _imp___winminor_dll;
235
236 #define _osver          (*_imp___osver_dll)
237 #define _winver         (*_imp___winver_dll)
238 #define _winmajor       (*_imp___winmajor_dll)
239 #define _winminor       (*_imp___winminor_dll)
240
241 #else /* __DECLSPEC_SUPPORTED */
242
243 __MINGW_IMPORT unsigned int     _osver_dll;
244 __MINGW_IMPORT unsigned int     _winver_dll;
245 __MINGW_IMPORT unsigned int     _winmajor_dll;
246 __MINGW_IMPORT unsigned int     _winminor_dll;
247
248 #define _osver          _osver_dll
249 #define _winver         _winver_dll
250 #define _winmajor       _winmajor_dll
251 #define _winminor       _winminor_dll
252
253 #endif /* __DECLSPEC_SUPPORTED */
254
255 #endif
256
257 #if defined  __MSVCRT__
258 /* although the _pgmptr is exported as DATA,
259  * be safe and use the access function __p__pgmptr() to get it. */
260 _CRTIMP char** __cdecl __MINGW_NOTHROW __p__pgmptr(void);
261 #define _pgmptr     (*__p__pgmptr())
262 _CRTIMP wchar_t** __cdecl __MINGW_NOTHROW __p__wpgmptr(void);
263 #define _wpgmptr    (*__p__wpgmptr())
264 #else /* ! __MSVCRT__ */
265 # ifndef __DECLSPEC_SUPPORTED
266   extern char** __imp__pgmptr_dll;
267 # define _pgmptr (*_imp___pgmptr_dll)
268 # else /* __DECLSPEC_SUPPORTED */
269  __MINGW_IMPORT char* _pgmptr_dll;
270 # define _pgmptr _pgmptr_dll
271 # endif /* __DECLSPEC_SUPPORTED */
272 /* no wide version in CRTDLL */
273 #endif /* __MSVCRT__ */
274
275 /*
276  * This variable determines the default file mode.
277  * TODO: Which flags work?
278  */
279 #if !defined (__DECLSPEC_SUPPORTED) || defined (__IN_MINGW_RUNTIME)
280
281 #ifdef __MSVCRT__
282 extern int* _imp___fmode;
283 #define _fmode  (*_imp___fmode)
284 #else
285 /* CRTDLL */
286 extern int* _imp___fmode_dll;
287 #define _fmode  (*_imp___fmode_dll)
288 #endif
289
290 #else /* __DECLSPEC_SUPPORTED */
291
292 #ifdef __MSVCRT__
293 __MINGW_IMPORT  int _fmode;
294 #else /* ! __MSVCRT__ */
295 __MINGW_IMPORT  int _fmode_dll;
296 #define _fmode  _fmode_dll
297 #endif /* ! __MSVCRT__ */
298
299 #endif /* __DECLSPEC_SUPPORTED */
300
301 #endif /* Not __STRICT_ANSI__ */
302
303 _CRTIMP double __cdecl __MINGW_NOTHROW  atof    (const char*);
304 _CRTIMP int __cdecl __MINGW_NOTHROW     atoi    (const char*);
305 _CRTIMP long __cdecl __MINGW_NOTHROW    atol    (const char*);
306 #if !defined (__STRICT_ANSI__)
307 _CRTIMP double __cdecl __MINGW_NOTHROW  _wtof (const wchar_t *);
308 _CRTIMP int __cdecl __MINGW_NOTHROW     _wtoi (const wchar_t *);
309 _CRTIMP long __cdecl __MINGW_NOTHROW _wtol (const wchar_t *);
310 #endif
311 #if !defined __NO_ISOCEXT  /*  in libmingwex.a */
312 double __cdecl __MINGW_NOTHROW __strtod (const char*, char**);
313 extern double __cdecl __MINGW_NOTHROW
314 strtod (const char* __restrict__ __nptr, char** __restrict__ __endptr);
315 float __cdecl __MINGW_NOTHROW strtof (const char * __restrict__, char ** __restrict__);
316 long double __cdecl __MINGW_NOTHROW strtold (const char * __restrict__, char ** __restrict__);
317 #else
318 _CRTIMP double __cdecl __MINGW_NOTHROW  strtod  (const char*, char**);
319 #endif /* __NO_ISOCEXT */
320
321 _CRTIMP long __cdecl __MINGW_NOTHROW    strtol  (const char*, char**, int);
322 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW   strtoul (const char*, char**, int);
323
324 #ifndef _WSTDLIB_DEFINED
325 /*  also declared in wchar.h */
326 _CRTIMP long __cdecl __MINGW_NOTHROW    wcstol  (const wchar_t*, wchar_t**, int);
327 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW   wcstoul (const wchar_t*, wchar_t**, int);
328 _CRTIMP double __cdecl __MINGW_NOTHROW  wcstod  (const wchar_t*, wchar_t**);
329 #if !defined __NO_ISOCEXT /*  in libmingwex.a */
330 float __cdecl __MINGW_NOTHROW wcstof( const wchar_t * __restrict__, wchar_t ** __restrict__);
331 long double __cdecl __MINGW_NOTHROW wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
332 #endif /* __NO_ISOCEXT */
333 #ifdef __MSVCRT__ 
334 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetenv(const wchar_t*);
335 _CRTIMP int __cdecl __MINGW_NOTHROW     _wputenv(const wchar_t*);
336 _CRTIMP void __cdecl __MINGW_NOTHROW    _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*);
337 _CRTIMP int __cdecl __MINGW_NOTHROW     _wsystem(const wchar_t*);
338 _CRTIMP void __cdecl __MINGW_NOTHROW    _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*);
339 _CRTIMP void __cdecl __MINGW_NOTHROW    _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*);
340 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW   _wfullpath (wchar_t*, const wchar_t*, size_t);
341 #endif
342 #define _WSTDLIB_DEFINED
343 #endif
344
345 _CRTIMP size_t __cdecl __MINGW_NOTHROW  wcstombs        (char*, const wchar_t*, size_t);
346 _CRTIMP int __cdecl __MINGW_NOTHROW     wctomb          (char*, wchar_t);
347
348 _CRTIMP int __cdecl __MINGW_NOTHROW     mblen           (const char*, size_t);
349 _CRTIMP size_t __cdecl __MINGW_NOTHROW  mbstowcs        (wchar_t*, const char*, size_t);
350 _CRTIMP int __cdecl __MINGW_NOTHROW     mbtowc          (wchar_t*, const char*, size_t);
351
352 _CRTIMP int __cdecl __MINGW_NOTHROW     rand    (void);
353 _CRTIMP void __cdecl __MINGW_NOTHROW    srand   (unsigned int);
354
355 _CRTIMP void* __cdecl __MINGW_NOTHROW   calloc  (size_t, size_t) __MINGW_ATTRIB_MALLOC;
356 _CRTIMP void* __cdecl __MINGW_NOTHROW   malloc  (size_t) __MINGW_ATTRIB_MALLOC;
357 _CRTIMP void* __cdecl __MINGW_NOTHROW   realloc (void*, size_t);
358 _CRTIMP void __cdecl __MINGW_NOTHROW    free    (void*);
359 _CRTIMP void __cdecl __MINGW_NOTHROW    abort   (void) __MINGW_ATTRIB_NORETURN;
360 _CRTIMP void __cdecl __MINGW_NOTHROW    exit    (int) __MINGW_ATTRIB_NORETURN;
361
362 /* Note: This is in startup code, not imported directly from dll */
363 int __cdecl __MINGW_NOTHROW     atexit  (void (*)(void));
364
365 _CRTIMP int __cdecl __MINGW_NOTHROW     system  (const char*);
366 _CRTIMP char* __cdecl __MINGW_NOTHROW   getenv  (const char*);
367
368 /* bsearch and qsort are also in non-ANSI header search.h  */
369 _CRTIMP void* __cdecl bsearch (const void*, const void*, size_t, size_t, 
370                                int (*)(const void*, const void*));
371 _CRTIMP void __cdecl qsort(void*, size_t, size_t,
372                            int (*)(const void*, const void*));
373
374 _CRTIMP int __cdecl __MINGW_NOTHROW     abs     (int) __MINGW_ATTRIB_CONST;
375 _CRTIMP long __cdecl __MINGW_NOTHROW    labs    (long) __MINGW_ATTRIB_CONST;
376
377 /*
378  * div_t and ldiv_t are structures used to return the results of div and
379  * ldiv.
380  *
381  * NOTE: div and ldiv appear not to work correctly unless
382  *       -fno-pcc-struct-return is specified. This is included in the
383  *       mingw32 specs file.
384  */
385 typedef struct { int quot, rem; } div_t;
386 typedef struct { long quot, rem; } ldiv_t;
387
388 _CRTIMP div_t __cdecl __MINGW_NOTHROW   div     (int, int) __MINGW_ATTRIB_CONST;
389 _CRTIMP ldiv_t __cdecl __MINGW_NOTHROW  ldiv    (long, long) __MINGW_ATTRIB_CONST;
390
391 #if !defined (__STRICT_ANSI__)
392
393 /*
394  * NOTE: Officially the three following functions are obsolete. The Win32 API
395  *       functions SetErrorMode, Beep and Sleep are their replacements.
396  */
397 _CRTIMP void __cdecl __MINGW_NOTHROW    _beep (unsigned int, unsigned int) __MINGW_ATTRIB_DEPRECATED;
398 /* Not to be confused with  _set_error_mode (int).  */
399 _CRTIMP void __cdecl __MINGW_NOTHROW    _seterrormode (int) __MINGW_ATTRIB_DEPRECATED;
400 _CRTIMP void __cdecl __MINGW_NOTHROW    _sleep (unsigned long) __MINGW_ATTRIB_DEPRECATED;
401
402 _CRTIMP void __cdecl __MINGW_NOTHROW    _exit   (int) __MINGW_ATTRIB_NORETURN;
403
404 /* _onexit is MS extension. Use atexit for portability.  */
405 /* Note: This is in startup code, not imported directly from dll */
406 typedef  int (* _onexit_t)(void);
407 _onexit_t __cdecl __MINGW_NOTHROW _onexit( _onexit_t );
408
409 _CRTIMP int __cdecl __MINGW_NOTHROW     _putenv (const char*);
410 _CRTIMP void __cdecl __MINGW_NOTHROW    _searchenv (const char*, const char*, char*);
411
412 _CRTIMP char* __cdecl __MINGW_NOTHROW   _ecvt (double, int, int*, int*);
413 _CRTIMP char* __cdecl __MINGW_NOTHROW   _fcvt (double, int, int*, int*);
414 _CRTIMP char* __cdecl __MINGW_NOTHROW   _gcvt (double, int, char*);
415
416 _CRTIMP void __cdecl __MINGW_NOTHROW    _makepath (char*, const char*, const char*, const char*, const char*);
417 _CRTIMP void __cdecl __MINGW_NOTHROW    _splitpath (const char*, char*, char*, char*, char*);
418 _CRTIMP char* __cdecl __MINGW_NOTHROW   _fullpath (char*, const char*, size_t);
419
420 _CRTIMP char* __cdecl __MINGW_NOTHROW   _itoa (int, char*, int);
421 _CRTIMP char* __cdecl __MINGW_NOTHROW   _ltoa (long, char*, int);
422 _CRTIMP char* __cdecl __MINGW_NOTHROW   _ultoa(unsigned long, char*, int);
423 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW  _itow (int, wchar_t*, int);
424 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW  _ltow (long, wchar_t*, int);
425 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW  _ultow (unsigned long, wchar_t*, int);
426
427 #ifdef __MSVCRT__
428 _CRTIMP __int64 __cdecl __MINGW_NOTHROW _atoi64(const char *);
429 _CRTIMP char* __cdecl __MINGW_NOTHROW   _i64toa(__int64, char *, int);
430 _CRTIMP char* __cdecl __MINGW_NOTHROW   _ui64toa(unsigned __int64, char *, int);
431 _CRTIMP __int64 __cdecl __MINGW_NOTHROW _wtoi64(const wchar_t *);
432 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _i64tow(__int64, wchar_t *, int);
433 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _ui64tow(unsigned __int64, wchar_t *, int);
434
435 _CRTIMP unsigned int __cdecl __MINGW_NOTHROW (_rotl)(unsigned int, int) __MINGW_ATTRIB_CONST;
436 _CRTIMP unsigned int __cdecl __MINGW_NOTHROW (_rotr)(unsigned int, int) __MINGW_ATTRIB_CONST;
437 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW (_lrotl)(unsigned long, int) __MINGW_ATTRIB_CONST;
438 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW (_lrotr)(unsigned long, int) __MINGW_ATTRIB_CONST;
439
440 _CRTIMP int __cdecl __MINGW_NOTHROW _set_error_mode (int);
441
442 # define _OUT_TO_DEFAULT        0
443 # define _OUT_TO_STDERR         1
444 # define _OUT_TO_MSGBOX         2
445 # define _REPORT_ERRMODE        3
446
447 # if __MSVCRT_VERSION__ >= 0x800
448 #  ifndef _UINTPTR_T_DEFINED
449 #   define _UINTPTR_T_DEFINED
450 #   ifdef _WIN64
451       typedef unsigned __int64 uintptr_t;
452 #   else
453       typedef unsigned int uintptr_t;
454 #   endif
455 #  endif
456
457 _CRTIMP unsigned int __cdecl __MINGW_NOTHROW _set_abort_behavior (unsigned int, unsigned int);
458
459 /* These masks work with msvcr80.dll version 8.0.50215.44 (a beta release).  */
460 #  define _WRITE_ABORT_MSG      1
461 #  define _CALL_REPORTFAULT     2
462
463 typedef void
464 (* _invalid_parameter_handler) (
465     const wchar_t *,
466     const wchar_t *,
467     const wchar_t *,
468     unsigned int,
469     uintptr_t);
470 _invalid_parameter_handler _set_invalid_parameter_handler (_invalid_parameter_handler);
471
472 # endif /* __MSVCRT_VERSION__ >= 0x800 */
473 #endif /* __MSVCRT__ */
474
475 #ifndef _NO_OLDNAMES
476
477 _CRTIMP int __cdecl __MINGW_NOTHROW     putenv (const char*);
478 _CRTIMP void __cdecl __MINGW_NOTHROW    searchenv (const char*, const char*, char*);
479
480 _CRTIMP char* __cdecl __MINGW_NOTHROW   itoa (int, char*, int);
481 _CRTIMP char* __cdecl __MINGW_NOTHROW   ltoa (long, char*, int);
482
483 #ifndef _UWIN
484 _CRTIMP char* __cdecl __MINGW_NOTHROW   ecvt (double, int, int*, int*);
485 _CRTIMP char* __cdecl __MINGW_NOTHROW   fcvt (double, int, int*, int*);
486 _CRTIMP char* __cdecl __MINGW_NOTHROW   gcvt (double, int, char*);
487 #endif /* _UWIN */
488 #endif  /* Not _NO_OLDNAMES */
489
490 #endif  /* Not __STRICT_ANSI__ */
491
492 /* C99 names */
493
494 #if !defined __NO_ISOCEXT /* externs in static libmingwex.a */
495
496 /* C99 name for _exit */
497 void __cdecl __MINGW_NOTHROW _Exit(int) __MINGW_ATTRIB_NORETURN;
498 #if !defined __NO_INLINE__ && !defined __STRICT_ANSI__
499 __CRT_INLINE void __cdecl __MINGW_NOTHROW _Exit(int __status)
500         {  _exit (__status); }
501 #endif 
502
503 typedef struct { long long quot, rem; } lldiv_t;
504
505 lldiv_t __cdecl __MINGW_NOTHROW lldiv (long long, long long) __MINGW_ATTRIB_CONST;
506
507 long long __cdecl __MINGW_NOTHROW llabs(long long);
508 #ifndef __NO_INLINE__
509 __CRT_INLINE long long __cdecl __MINGW_NOTHROW llabs(long long _j)
510   {return (_j >= 0 ? _j : -_j);}
511 #endif
512
513 long long  __cdecl __MINGW_NOTHROW strtoll (const char* __restrict__, char** __restrict, int);
514 unsigned long long  __cdecl __MINGW_NOTHROW strtoull (const char* __restrict__, char** __restrict__, int);
515
516 #if defined (__MSVCRT__) /* these are stubs for MS _i64 versions */ 
517 long long  __cdecl __MINGW_NOTHROW atoll (const char *);
518
519 #if !defined (__STRICT_ANSI__)
520 long long  __cdecl __MINGW_NOTHROW wtoll (const wchar_t *);
521 char* __cdecl __MINGW_NOTHROW lltoa (long long, char *, int);
522 char* __cdecl __MINGW_NOTHROW ulltoa (unsigned long long , char *, int);
523 wchar_t* __cdecl __MINGW_NOTHROW lltow (long long, wchar_t *, int);
524 wchar_t* __cdecl __MINGW_NOTHROW ulltow (unsigned long long, wchar_t *, int);
525
526   /* inline using non-ansi functions */
527 #ifndef __NO_INLINE__
528 __CRT_INLINE long long  __cdecl __MINGW_NOTHROW atoll (const char * _c)
529         { return _atoi64 (_c); }
530 __CRT_INLINE char*  __cdecl __MINGW_NOTHROW lltoa (long long _n, char * _c, int _i)
531         { return _i64toa (_n, _c, _i); }
532 __CRT_INLINE char*  __cdecl __MINGW_NOTHROW ulltoa (unsigned long long _n, char * _c, int _i)
533         { return _ui64toa (_n, _c, _i); }
534 __CRT_INLINE long long  __cdecl __MINGW_NOTHROW wtoll (const wchar_t * _w)
535         { return _wtoi64 (_w); }
536 __CRT_INLINE wchar_t*  __cdecl __MINGW_NOTHROW lltow (long long _n, wchar_t * _w, int _i)
537         { return _i64tow (_n, _w, _i); } 
538 __CRT_INLINE wchar_t*  __cdecl __MINGW_NOTHROW ulltow (unsigned long long _n, wchar_t * _w, int _i)
539         { return _ui64tow (_n, _w, _i); } 
540 #endif /* (__NO_INLINE__) */
541 #endif /* (__STRICT_ANSI__)  */
542
543 #endif /* __MSVCRT__ */
544
545 #endif /* !__NO_ISOCEXT */
546
547
548 #ifdef __cplusplus
549 }
550 #endif
551
552 #endif  /* Not RC_INVOKED */
553
554 #endif  /* Not _STDLIB_H_ */
555