blob: 3f77c04a48bba2b3906b438a85ba97718fd70d50 [file] [log] [blame] [raw]
/*
* stdlib.h
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Definitions for common types, variables, and functions.
*
*/
#ifndef _STDLIB_H
#define _STDLIB_H
/* All the headers include this file. */
#include <_mingw.h>
#define __need_size_t
#define __need_wchar_t
#define __need_NULL
#include <stddef.h>
/*
* RAND_MAX is the maximum value that may be returned by rand.
* The minimum is zero.
*/
#define RAND_MAX 0x7FFF
/*
* These values may be used as exit status codes.
*/
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
/*
* Definitions for path name functions.
* NOTE: All of these values have simply been chosen to be conservatively high.
* Remember that with long file names we can no longer depend on
* extensions being short.
*/
#ifndef __STRICT_ANSI__
#ifndef MAX_PATH
#define MAX_PATH (260)
#endif
#endif /* Not __STRICT_ANSI__ */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef MB_CUR_MAX
#define MB_CUR_MAX 1
#endif
char ***__cdecl _environ(void);
#ifndef _NO_ENVIRON_VAR_DEF
/* This definition will allow you redeclare environ like `extern char **environ';
but if you need name a local variable as `environ',
you should ether define _NO_ENVIRON_VAR_DEF before including stdlib.h,
or undef environ after include stdlib.h. */
#define environ (*_environ())
#endif
_CRTIMP double __cdecl __MINGW_NOTHROW atof(const char *);
_CRTIMP int __cdecl __MINGW_NOTHROW atoi(const char *);
_CRTIMP long __cdecl __MINGW_NOTHROW atol(const char *);
_CRTIMP double __cdecl __MINGW_NOTHROW strtod(const char *, char **);
#if !defined __NO_ISOCEXT /* in libmingwex.a */
float __cdecl __MINGW_NOTHROW strtof (const char *__restrict__, char **__restrict__);
long double __cdecl __MINGW_NOTHROW strtold (const char *__restrict__, char **__restrict__);
#endif /* __NO_ISOCEXT */
_CRTIMP long __cdecl __MINGW_NOTHROW strtol(const char *, char **, int);
_CRTIMP unsigned long __cdecl __MINGW_NOTHROW strtoul(const char *, char **, int);
_CRTIMP size_t __cdecl __MINGW_NOTHROW wcstombs(char *, const wchar_t *, size_t);
_CRTIMP int __cdecl __MINGW_NOTHROW wctomb(char *, wchar_t);
_CRTIMP int __cdecl __MINGW_NOTHROW mblen(const char *, size_t);
_CRTIMP size_t __cdecl __MINGW_NOTHROW mbstowcs(wchar_t *, const char *, size_t);
_CRTIMP int __cdecl __MINGW_NOTHROW mbtowc(wchar_t *, const char *, size_t);
_CRTIMP int __cdecl __MINGW_NOTHROW rand(void);
_CRTIMP void __cdecl __MINGW_NOTHROW srand(unsigned int);
_CRTIMP void *__cdecl __MINGW_NOTHROW calloc(size_t, size_t) __MINGW_ATTRIB_MALLOC;
_CRTIMP void *__cdecl __MINGW_NOTHROW malloc(size_t) __MINGW_ATTRIB_MALLOC;
_CRTIMP void *__cdecl __MINGW_NOTHROW realloc(void *, size_t);
_CRTIMP void __cdecl __MINGW_NOTHROW free(void *);
_CRTIMP void __cdecl __MINGW_NOTHROW abort(void) __MINGW_ATTRIB_NORETURN;
_CRTIMP void __cdecl __MINGW_NOTHROW exit(int) __MINGW_ATTRIB_NORETURN;
/* Note: This is in startup code, not imported directly from dll */
int __cdecl __MINGW_NOTHROW atexit(void (*)(void));
_CRTIMP int __cdecl __MINGW_NOTHROW system(const char *);
_CRTIMP char *__cdecl __MINGW_NOTHROW getenv(const char *);
/* bsearch and qsort are also in non-ANSI header search.h */
_CRTIMP void *__cdecl bsearch(const void *, const void *, size_t, size_t,
int (*)(const void *, const void *));
_CRTIMP void __cdecl qsort(void *, size_t, size_t,
int (*)(const void *, const void *));
_CRTIMP int __cdecl __MINGW_NOTHROW abs(int) __MINGW_ATTRIB_CONST;
_CRTIMP long __cdecl __MINGW_NOTHROW labs(long) __MINGW_ATTRIB_CONST;
/*
* div_t and ldiv_t are structures used to return the results of div and
* ldiv.
*
* NOTE: div and ldiv appear not to work correctly unless
* -fno-pcc-struct-return is specified. This is included in the
* mingw32 specs file.
*/
typedef struct { int quot, rem; } div_t;
typedef struct { long quot, rem; } ldiv_t;
_CRTIMP div_t __cdecl __MINGW_NOTHROW div(int, int) __MINGW_ATTRIB_CONST;
_CRTIMP ldiv_t __cdecl __MINGW_NOTHROW ldiv(long, long) __MINGW_ATTRIB_CONST;
_CRTIMP int __cdecl __MINGW_NOTHROW putenv(char *);
//_CRTIMP void __cdecl __MINGW_NOTHROW searchenv(const char *, const char *, char *);
/* C99 name for _exit */
void __cdecl __MINGW_NOTHROW _Exit(int) __MINGW_ATTRIB_NORETURN;
__CRT_INLINE void __cdecl __MINGW_NOTHROW _Exit(int __status)
{ void __cdecl _exit(int); _exit (__status); }
typedef struct { long long quot, rem; } lldiv_t;
lldiv_t __cdecl __MINGW_NOTHROW lldiv(long long, long long) __MINGW_ATTRIB_CONST;
long long __cdecl __MINGW_NOTHROW llabs(long long);
__CRT_INLINE long long __cdecl __MINGW_NOTHROW llabs(long long _j)
{return (_j >= 0 ? _j : -_j);}
long long int __cdecl __MINGW_NOTHROW strtoll(const char *__restrict__, char **__restrict, int);
unsigned long long int __cdecl __MINGW_NOTHROW strtoull (const char *__restrict__, char **__restrict__, int);
long long int __cdecl __MINGW_NOTHROW atoll(const char *);
#ifdef __cplusplus
}
#endif
#endif