scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

stdlib.h (2534B)


      1 #ifndef _STDLIB_H
      2 #define _STDLIB_H
      3 
      4 #define _NEED_NULL
      5 #define _NEED_SIZET
      6 #define _NEED_WCHART
      7 #include <sys/cdefs.h>
      8 #include <arch/cdefs.h>
      9 #include <arch/stdlib.h>
     10 
     11 #define _ATEXIT_MAX 32
     12 
     13 #define MB_CUR_MAX 1
     14 #define RAND_MAX 32767
     15 
     16 typedef struct {
     17 	int quot, rem;
     18 } div_t;
     19 
     20 typedef struct {
     21 	long quot, rem;
     22 } ldiv_t;
     23 
     24 typedef struct {
     25 	long long quot, rem;
     26 } lldiv_t;
     27 
     28 extern double atof(const char *nptr);
     29 extern int atoi(const char *nptr);
     30 extern long int atol(const char *nptr);
     31 extern long long int atoll(const char *nptr);
     32 extern double strtod(const char * restrict nptr, char ** restrict endptr);
     33 extern float strtof(const char * restrict nptr, char ** restrict endptr);
     34 extern long double strtold(const char * restrict nptr, char ** restrict endptr);
     35 extern long int strtol(const char * restrict nptr, char ** restrict endptr, int base);
     36 extern long long int strtoll(const char * restrict nptr, char ** restrict endptr,
     37                              int base);
     38 extern unsigned long int strtoul(const char * restrict nptr, char ** restrict endptr,
     39                                  int base);
     40 extern unsigned long long int strtoull(const char * restrict nptr,
     41                                        char ** restrict endptr, int base);
     42 extern int rand(void);
     43 extern void srand(unsigned int seed);
     44 extern void *calloc(size_t nmemb, size_t size);
     45 extern void free(void *ptr);
     46 extern void *malloc(size_t size);
     47 extern void *realloc(void *ptr, size_t size);
     48 extern void abort(void);
     49 extern int atexit(void (*func)(void));
     50 extern void exit(int status);
     51 extern void _Exit(int status);
     52 extern char *getenv(const char *name);
     53 extern int system(const char *string);
     54 extern void *bsearch(const void *key, const void *base, size_t nmemb, size_t size,
     55                      int (*compar)(const void *, const void *));
     56 extern void qsort(void *base, size_t nmemb, size_t size,
     57                   int (*compar)(const void *, const void *));
     58 extern int abs(int j);
     59 extern long int labs(long int j);
     60 extern long long int llabs(long long int j);
     61 extern div_t div(int numer, int denom);
     62 extern ldiv_t ldiv(long int numer, long int denom);
     63 extern lldiv_t lldiv(long long int numer, long long int denom);
     64 extern int mblen(const char *s, size_t n);
     65 extern int mbtowc(wchar_t * restrict pwc, const char * restrict s, size_t n);
     66 extern int wctomb(char *s, wchar_t wchar);
     67 extern size_t mbstowcs(wchar_t * restrict pwcs, const char * restrict s, size_t n);
     68 extern size_t wcstombs(char * restrict s, const wchar_t * restrict pwcs, size_t n);
     69 
     70 #endif