2002-06-15 15:49:32 +00:00
|
|
|
/*
|
|
|
|
* stdlib.h
|
|
|
|
*
|
|
|
|
* Definitions for common types, variables, and functions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _STDLIB_H_
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
#define _STDLIB_H_
|
|
|
|
|
|
|
|
#include "_ansi.h"
|
|
|
|
|
|
|
|
#define __need_size_t
|
|
|
|
#define __need_wchar_t
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
#ifndef NULL
|
2007-10-15 07:59:13 +00:00
|
|
|
#define NULL ((void*)0)
|
2002-06-15 15:49:32 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define EXIT_FAILURE 1
|
|
|
|
#define EXIT_SUCCESS 0
|
|
|
|
|
2010-02-22 21:24:09 +00:00
|
|
|
_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR)));
|
2002-06-15 15:49:32 +00:00
|
|
|
|
2002-06-17 13:19:18 +00:00
|
|
|
void *malloc(size_t);
|
|
|
|
void *calloc (size_t nmemb, size_t size);
|
|
|
|
void free(void *);
|
|
|
|
void *realloc(void *, size_t);
|
2010-05-15 21:02:47 +00:00
|
|
|
int atexit(void (*)(void));
|
2002-06-17 13:19:18 +00:00
|
|
|
|
2005-02-15 13:28:39 +00:00
|
|
|
#define RAND_MAX INT_MAX
|
2004-07-23 10:38:16 +00:00
|
|
|
|
2005-02-15 13:28:39 +00:00
|
|
|
void srand(unsigned int seed);
|
|
|
|
int rand(void);
|
2002-07-17 23:07:45 +00:00
|
|
|
|
2009-08-03 01:38:58 +00:00
|
|
|
#ifndef ABS
|
|
|
|
#if defined(__GNUC__)
|
|
|
|
#define ABS(a) ({typeof (a) ___a = (a); ___a < 0 ? -___a: ___a; })
|
|
|
|
#else
|
|
|
|
#define ABS(a) (((a) < 0) ? -(a) : (a))
|
|
|
|
#endif /* __GNUC__ */
|
|
|
|
#endif
|
|
|
|
|
2010-05-06 21:04:40 +00:00
|
|
|
#define abs(x) ((int)ABS(x))
|
|
|
|
#define labs(x) ((long)abs(x))
|
2002-06-17 13:19:18 +00:00
|
|
|
|
2005-02-18 15:37:56 +00:00
|
|
|
#ifdef SIMULATOR
|
|
|
|
void exit(int status);
|
|
|
|
#endif
|
2008-04-28 16:18:04 +00:00
|
|
|
|
|
|
|
int atoi (const char *str);
|
2010-05-15 21:02:47 +00:00
|
|
|
|
2002-06-15 15:49:32 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* _STDLIB_H_ */
|