scc

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

stdlib.h (2195B)


      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 <sys/stdlib.h>
      9 #include <arch/cdefs.h>
     10 #include <arch/stdlib.h>
     11 
     12 #define _ATEXIT_MAX 32
     13 #define MB_CUR_MAX 4
     14 
     15 #define RAND_MAX 32767
     16 
     17 typedef struct {
     18 	int quot, rem;
     19 } div_t;
     20 
     21 typedef struct {
     22 	long quot, rem;
     23 } ldiv_t;
     24 
     25 typedef struct {
     26 	long long quot, rem;
     27 } lldiv_t;
     28 
     29 extern double atof(const char *);
     30 extern int atoi(const char *);
     31 extern long int atol(const char *);
     32 extern long long int atoll(const char *);
     33 extern double strtod(const char *restrict, char **restrict);
     34 extern float strtof(const char *restrict, char **restrict);
     35 extern long double strtold(const char *restrict, char **restrict);
     36 extern long int strtol(const char *restrict, char **restrict, int);
     37 extern long long int strtoll(const char *restrict, char **restrict, int);
     38 extern unsigned long int strtoul(const char *restrict, char **restrict, int);
     39 extern unsigned long long int strtoull(const char *restrict, char **restrict,
     40                                        int);
     41 extern int rand(void);
     42 extern void srand(unsigned int);
     43 extern void *calloc(size_t, size_t);
     44 extern void free(void *);
     45 extern void *malloc(size_t);
     46 extern void *realloc(void *, size_t);
     47 extern void abort(void);
     48 extern int atexit(void (*)(void));
     49 extern void exit(int);
     50 extern void _Exit(int);
     51 extern char *getenv(const char *);
     52 extern int system(const char *);
     53 extern void *bsearch(const void *, const void *, size_t, size_t,
     54                      int (*)(const void *, const void *));
     55 extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
     56 extern int abs(int);
     57 extern long int labs(long int);
     58 extern long long int llabs(long long int);
     59 extern div_t div(int, int);
     60 extern ldiv_t ldiv(long int, long int);
     61 extern lldiv_t lldiv(long long int, long long int);
     62 
     63 extern int mblen(const char *, size_t);
     64 extern int mbtowc(wchar_t *restrict, const char *restrict, size_t);
     65 extern int wctomb(char *, wchar_t);
     66 extern size_t mbstowcs(wchar_t *restrict, const char *restrict, size_t);
     67 extern size_t wcstombs(char *restrict, const wchar_t *restrict, size_t);
     68 
     69 #define mblen(s,n) mbtowc(NULL, s, n)
     70 
     71 #endif