scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

stdlib.h (2474B)


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