1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
4 // Public Domain C Library - http://pdclib.sourceforge.net
5 // This code is Public Domain. Use, modify, and redistribute at will.
6 // ----------------------------------------------------------------------------
8 // ----------------------------------------------------------------------------
11 #define __STDLIB_H __STDLIB_H
13 // ----------------------------------------------------------------------------
16 #define EXIT_FAILURE // TODO
17 #define EXIT_SUCCESS // TODO
18 #define MB_CUR_MAX // TODO
20 #define RAND_MAX // TODO
22 // ----------------------------------------------------------------------------
42 typedef size_t; // TODO
45 typedef wchar_t; // TODO
48 // ----------------------------------------------------------------------------
54 long long abs( long long i );
56 ldiv_t div( long numer, long denom );
57 lldiv_t div( long long numer, long long denom );
59 extern "C++" int atexit( void (*func) ( void ) );
60 extern "C" int atexit( void (*func) ( void ) );
62 extern "C++" void * bsearch( const void * key, const void * base,
63 size_t nelem, size_t size,
64 int (*cmp) ( const void * ck, const void * ce ) );
65 extern "C" void * bsearch( const void * key, const void * base,
66 size_t nelem, size_t size,
67 int (*cmp) ( const void * ck, const void * ce ) );
69 extern "C++" void qsort( void * base, size_t nelem, size_t size,
70 int (*cmp) ( const void * e1, const void * e2 ) );
71 extern "C" void qsort( void * base, size_t nelem, size_t size,
72 int (*cmp) ( const void * e1, const void * e2 ) );
76 // ----------------------------------------------------------------------------
77 // FUNCTIONS - Standard C
80 long long llabs( long long i );
83 div_t div( int numer, int denom );
84 lldiv_t lldiv( long long numer, long long denom );
85 ldiv_t ldiv( long numer, long denom );
88 void srand( unsigned int seed );
90 double atof( const char * s );
91 int atoi( const char * s );
92 long atol( const char * s );
93 long long atoll( const char * s);
95 double strtod( const char * restrict s, char * * restrict endptr );
96 float strtof( const char * restrict s, char * * restrict endptr );
97 long double strtold( const char * restrict s, char * * restrict endptr );
99 long long strtoll( const char * restrict s, char * * restrict endptr, int base );
100 unsigned long long strtoull( const char * restrict s, char * * restrict endptr, int base);
102 long strtol( const char * restrict s, char * * restrict endptr, int base );
103 unsigned long strtoul( const char * restrict s, char * * restrict endptr, int base);
105 void * calloc( size_t nelem, size_t size );
106 void free( void * ptr );
107 void * malloc( size_t size );
108 void * realloc( void * ptr, size_t size );
110 int mblen( const char * s, size_t n );
111 size_t mbstowcs( wchar_t * restrict wcs, const char * restrict s, size_t n );
112 int mbtowc( wchar_t * restrict pwc, const char * restrict s, size_t n );
113 size_t wcstombs( char * restrict s, const wchar_t * restrict wcs, size_t n );
114 int wctomb( char * s, wchar_t wchar );
116 void _Exit( int status );
117 void exit( int status );
119 char * getenv( const char * name );
120 int system( const char * s );
124 int atexit( void (*func) ( void ) );
125 void * bsearch( const void * key, const void * base, size_t nelem, size_t size,
126 int (*cmp) ( const void * ck, const void * ce) );
127 void qsort( void * base, size_t nelem, size_t size,
128 int (*cmp) ( const void * e1, const void * e2) );
130 #endif // __cplusplus