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 );
61 // ----------------------------------------------------------------------------
62 // FUNCTIONS - Standard C
65 long long llabs( long long i );
68 div_t div( int numer, int denom );
69 lldiv_t lldiv( long long numer, long long denom );
70 ldiv_t ldiv( long numer, long denom );
73 void srand( unsigned int seed );
75 double atof( const char * s );
76 int atoi( const char * s );
77 long atol( const char * s );
78 long long atoll( const char * s);
80 double strtod( const char * restrict s, char * * restrict endptr );
81 float strtof( const char * restrict s, char * * restrict endptr );
82 long double strtold( const char * restrict s, char * * restrict endptr );
84 long long strtoll( const char * restrict s, char * * restrict endptr, int base );
85 unsigned long long strtoull( const char * restrict s, char * * restrict endptr, int base);
87 long strtol( const char * restrict s, char * * restrict endptr, int base );
88 unsigned long strtoul( const char * restrict s, char * * restrict endptr, int base);
90 void * calloc( size_t nelem, size_t size );
91 void free( void * ptr );
92 void * malloc( size_t size );
93 void * realloc( void * ptr, size_t size );
95 int mblen( const char * s, size_t n );
96 size_t mbstowcs( wchar_t * restrict wcs, const char * restrict s, size_t n );
97 int mbtowc( wchar_t * restrict pwc, const char * restrict s, size_t n );
98 size_t wcstombs( char * restrict s, const wchar_t * restrict wcs, size_t n );
99 int wctomb( char * s, wchar_t wchar );
101 void _Exit( int status );
102 void exit( int status );
104 char * getenv( const char * name );
105 int system( const char * s );
108 #define __cppwrapper( x ) extern "C++" x \
111 #define __cppwrapper( x ) x
112 #endif // __cplusplus
114 __cppwrapper( int atexit( void (*func) ( void ) ) { /* TODO */ }; )
115 __cppwrapper( void * bsearch( const void * key, const void * base, size_t nelem, size_t size, int (*cmp) ( const void * ck, const void * ce) ) { /* TODO */ }; )
116 __cppwrapper( void qsort( void * base, size_t nelem, size_t size, int (*cmp) ( const void * e1, const void * e2) ) { /* TODO */ }; )