PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
stdlib.h
1 #ifndef _STDLIB_H
2 #define _STDLIB_H
3 
4 #include <sys/size_t.h>
5 #include <sys/wchar_t.h>
6 #include <sys/null.h>
7 #include <compiler.h>
8 
9 #if defined(__cplusplus)
10 extern "C" {
11 #endif
12 
13 #define EXIT_FAILURE 1
14 #define EXIT_SUCCESS 0
15 
16  double atof(const char *);
17  int atoi(const char *);
18  long atol(const char *);
19  long long atoll(const char *);
20 
21  long double strtold(const char *nptr, char **endptr);
22  double strtod(const char *nptr, char **endptr);
23  float strtof(const char *nptr, char **endptr);
24 
25  long strtol(const char *nptr, char **endptr, int base);
26  unsigned long strtoul(const char *nptr, char **endptr, int base);
27  long long strtoll(const char *nptr, char **endptr, int base);
28  unsigned long long strtoull(const char *nptr, char **endptr, int base);
29 
30 #define RAND_MAX 0x7fff
31  int rand(void);
32  void srand(unsigned int seed);
33 
34  void *malloc(size_t n);
35  void *calloc(size_t, size_t);
36  void *realloc(void *, size_t);
37  void free(void *);
38 
39  void *_hubmalloc(size_t n);
40  void *_hubcalloc(size_t, size_t);
41  void *_hubrealloc(void *, size_t);
42  void _hubfree(void *);
43 
44 #if !defined(__STRICT_ANSI__)
45  void *hubmalloc(size_t n);
46  void *hubcalloc(size_t, size_t);
47  void *hubrealloc(void *, size_t);
48  void hubfree(void *);
49 #endif
50 
51  int atexit(void (*func)(void));
52  _NORETURN void exit(int status);
53  _NORETURN void abort(void);
54  _NORETURN void _Exit(int status); /* like exit(), but skips atexit() stuff */
55  _NORETURN void _exit(int status); /* nonstandard name for _Exit() */
56 
57  _CONST int abs(int i);
58  _CONST long labs(long l);
59  _CONST long long llabs(long long ll);
60 
61  typedef struct {
62  int quot, rem;
63  } div_t;
64 
65  typedef struct {
66  long int quot, rem;
67  } ldiv_t;
68 
69  typedef struct {
70  long long quot, rem;
71  } lldiv_t;
72 
73  div_t div(int num, int denom);
74  ldiv_t ldiv(long num, long denom);
75  lldiv_t lldiv(long long num, long long denom);
76 
77  void qsort(void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *));
78  void *bsearch(const void *key, const void *base, size_t nmemb, size_t size,
79  int (*compare)(const void *, const void *));
80 
81  char *getenv(const char *name);
82 
83  /* multibyte character functions */
84  extern int _mb_cur_max;
85 #define MB_CUR_MAX _mb_cur_max
86 #define MB_LEN_MAX 4 /* in Unicode up to 4 UTF-8 bytes per unicode wchar_t */
87 
88  int mblen(const char *s, size_t n);
89  int mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n);
90  size_t mbstowcs(wchar_t *dest, const char *src, size_t n);
91 
92  /* not implemented */
93  int system(const char *command);
94 
95 #if defined(_POSIX_SOURCE) || defined(_GNU_SOURCE)
96  /* some non-ANSI functions */
97  int putenv(char *string);
98 #endif
99 
100  int _itoa_prec( unsigned int x, char *buf, unsigned base, int prec );
101  int _lltoa_prec( unsigned long long x, char *buf, unsigned base, int prec );
102 
103 #if defined(__cplusplus)
104 }
105 #endif
106 
107 #endif
div_t
Definition: stdlib.h:61
x
int x
Definition: 07 Box and Lines.c:13
compiler.h
Defines features of the compiler being used.
lldiv_t
Definition: stdlib.h:69
ldiv_t
Definition: stdlib.h:65