source: CIVL/include/headers/stdlib.h@ 1aaefd4

main test-branch
Last change on this file since 1aaefd4 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 4.3 KB
Line 
1/* The header stdlib.h declare an assortment of useful functions
2 * and to define the macros and types that help you use them.
3 */
4
5#ifndef _STDLIB_
6#define _STDLIB_
7
8/* Types */
9
10typedef unsigned long int size_t;
11
12typedef int wchar_t;
13
14typedef struct _div_t {
15 int quot;
16 int rem;
17} div_t;
18
19typedef struct _ldiv_t {
20 long int quot;
21 long int rem;
22} ldiv_t;
23
24typedef struct _lldiv_t {
25 long long int quot;
26 long long int rem;
27} lldiv_t;
28
29
30/* Constants defined */
31#ifndef NULL
32#define NULL ((void*)0)
33#endif
34
35#define EXIT_FAILURE 1
36
37#define EXIT_SUCCESS 0
38
39#define MB_CUR_MAX 2
40
41#define RAND_MAX 9999999
42
43/* Functions defined */
44
45$system double atof(const char *nptr);
46
47int atoi(const char *nptr);
48
49long int atol(const char *nptr);
50
51long long int atoll(const char *nptr);
52
53double strtod(const char * restrict nptr,
54 char ** restrict endptr);
55
56float strtof(const char * restrict nptr,
57 char ** restrict endptr);
58
59long double strtold(const char * restrict nptr,
60 char ** restrict endptr);
61
62long int strtol(const char * restrict nptr,
63 char ** restrict endptr, int base);
64
65long long int strtoll(const char * restrict nptr,
66 char ** restrict endptr, int base);
67
68unsigned long int strtoul(
69 const char * restrict nptr,
70 char ** restrict endptr, int base);
71
72unsigned long long int strtoull(
73 const char * restrict nptr,
74 char ** restrict endptr, int base);
75
76int rand(void);
77
78void srand(unsigned int seed);
79
80long int random(void);
81
82void srandom(unsigned int seed);
83
84void *aligned_alloc(size_t alignment, size_t size);
85
86void *calloc(size_t nmemb, size_t size);
87
88void free(void *ptr);
89
90void *malloc(size_t size);
91
92void *realloc(void *ptr, size_t size);
93
94_Noreturn void abort(void);
95
96int atexit(void (*func)(void));
97
98int at_quick_exit(void (*func)(void));
99
100void exit(int status);
101
102_Noreturn void _Exit(int status);
103
104char *getenv(const char *name);
105
106_Noreturn void quick_exit(int status);
107
108int system(const char *string);
109
110void *bsearch(const void *key, const void *base,
111 size_t nmemb, size_t size,
112 int (*compar)(const void *, const void *));
113
114void qsort(void *base, size_t nmemb, size_t size,
115 int (*compar)(const void *, const void *));
116
117int abs(int j);
118
119long int labs(long int j);
120
121long long int llabs(long long int j);
122
123div_t div(int numer, int denom);
124
125ldiv_t ldiv(long int numer, long int denom);
126
127lldiv_t lldiv(long long int numer,
128 long long int denom);
129
130int mblen(const char *s, size_t n);
131
132int mbtowc(wchar_t * restrict pwc,
133 const char * restrict s, size_t n);
134
135int wctomb(char *s, wchar_t wchar);
136
137size_t mbstowcs(wchar_t * restrict pwcs,
138 const char * restrict s, size_t n);
139
140size_t wcstombs(char * restrict s,
141 const wchar_t * restrict pwcs, size_t n);
142
143#define __STDC_WANT_LIB_EXT1__ 1
144
145typedef int errno_t;
146
147typedef size_t rsize_t;
148
149typedef void (*constraint_handler_t)(
150 const char * restrict msg,
151 void * restrict ptr,
152 errno_t error);
153
154
155constraint_handler_t set_constraint_handler_s(
156 constraint_handler_t handler);
157
158void abort_handler_s(
159 const char * restrict msg,
160 void * restrict ptr,
161 errno_t error);
162
163void ignore_handler_s(
164 const char * restrict msg,
165 void * restrict ptr,
166 errno_t error);
167
168errno_t getenv_s(size_t * restrict len,
169 char * restrict value, rsize_t maxsize,
170 const char * restrict name);
171
172void *bsearch_s(const void *key, const void *base,
173 rsize_t nmemb, rsize_t size,
174 int (*compar)(const void *k, const void *y,
175 void *context),
176 void *context);
177
178errno_t qsort_s(void *base, rsize_t nmemb, rsize_t size,
179 int (*compar)(const void *x, const void *y,
180 void *context),
181 void *context);
182
183errno_t wctomb_s(int * restrict status,
184 char * restrict s,
185 rsize_t smax,
186 wchar_t wc);
187
188errno_t mbstowcs_s(size_t * restrict retval,
189 wchar_t * restrict dst, rsize_t dstmax,
190 const char * restrict src, rsize_t len);
191
192errno_t wcstombs_s(size_t * restrict retval,
193 char * restrict dst, rsize_t dstmax,
194 const wchar_t * restrict src, rsize_t len);
195
196#ifdef _LINUX
197int rand_r(unsigned int *seedp);
198int posix_memalign(void **memptr, size_t alignment, size_t size);
199#endif
200
201#endif
Note: See TracBrowser for help on using the repository browser.