Don't call ReadArgs() if started from WB.
[tangerine.git] / compiler / clib / include / stdlib.h
bloba09d44cbc8639bf9f270ad93576538467886b046
1 #ifndef _STDLIB_H_
2 #define _STDLIB_H_
4 /*
5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: ANSI-C header file stdlib.h
9 Lang: English
12 #include <sys/cdefs.h>
13 #include <sys/arosc.h>
15 /* It seems that also stdlib.h defines alloca() */
16 #include <alloca.h>
18 /* For wchar_t and size_t */
19 #include <stddef.h>
21 /* Types for div and ldiv */
22 typedef struct div_t {
23 int quot;
24 int rem;
25 } div_t;
27 typedef struct ldiv_t {
28 long int quot;
29 long int rem;
30 } ldiv_t;
32 #if defined AROS_HAVE_LONG_LONG
33 typedef struct lldiv_t {
34 long long int quot;
35 long long int rem;
36 } lldiv_t;
37 #endif
39 #ifndef NULL
40 #define NULL 0
41 #endif
43 #define EXIT_SUCCESS 0 /* Success exit status */
44 #define EXIT_FAILURE 20 /* Failing exit status */
46 /* Gives the largest size of a multibyte character for the current locale */
47 #define MB_CUR_MAX (__get_arosc_userdata()->acud_mb_cur_max)
49 __BEGIN_DECLS
51 /* String conversion functions */
52 double atof(const char *nptr);
53 int atoi(const char *nptr);
54 long int atol(const char *nptr);
55 #if defined AROS_HAVE_LONG_LONG
56 long long int atoll(const char *nptr);
57 #endif
59 double strtod(const char * restrict nptr, char ** restrict endptr);
60 float strtof(const char * restrict nptr, char ** restrict endptr);
61 long double strtold(const char * restrict nptr, char ** restrict endptr);
62 long int strtol(const char * restrict nptr,
63 char ** restrict endptr,
64 int base);
65 unsigned long int strtoul(const char * restrict nptr,
66 char ** restrict endptr,
67 int base);
69 #if defined AROS_HAVE_LONG_LONG
70 long long int strtoll(const char * restrict nptr,
71 char ** restrict endptr,
72 int base);
73 unsigned long long int strtoull(const char * restrict nptr,
74 char ** restrict endptr,
75 int base);
76 #endif
78 /* Pseudo-random number generation functions */
79 int rand (void);
80 void srand (unsigned int seed);
82 /* Max. number returned by rand() */
83 #ifndef RAND_MAX
84 # define RAND_MAX 2147483647
85 #endif
87 /* Unix pseudo-random functions */
88 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
89 #ifndef AROS_NOFPU
90 double drand48(void);
91 double erand48(unsigned short int xsubi[3]);
92 #else
93 void drand48(void);
94 void erand48(unsigned short int xsubi[3]);
95 #endif
96 long int lrand48(void);
97 long int nrand48(unsigned short int xsubi[3]);
98 long int mrand48(void);
99 long int jrand48(unsigned short int xsubi[3]);
100 void srand48(long int seedval);
101 unsigned short int *seed48(unsigned short int seed16v[3]);
102 void lcong48(unsigned short int param[7]);
104 /* Thread safe random */
105 int rand_r(unsigned int *);
107 long random(void);
108 void srandom(unsigned seed);
109 char *initstate(unsigned seed, char *state, int n);
110 char *setstate(char *state);
111 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
113 /* Memory management functions */
114 void *malloc(size_t size);
115 void *calloc(size_t count, size_t size);
116 void *realloc(void *oldmem, size_t newsize);
117 void *realloc_nocopy(void *oldmem, size_t newsize); /* AROS specific */
118 void free(void *memory);
120 /* Communication with the environment */
121 void abort (void) __noreturn;
122 int atexit(void (*func)(void));
123 int on_exit(void (*func)(int, void *), void *);
124 void exit (int code) __noreturn;
125 int system(const char *string);
126 char *getenv(const char *name);
128 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
129 int putenv(const char *string);
130 int setenv(const char *name, const char *value, int overwrite);
131 void unsetenv(const char *name);
132 #endif
134 /* Searching and sorting utilities */
135 void qsort(void * array, size_t count, size_t elementsize,
136 int (*comparefunction)(const void * element1, const void * element2));
137 void *bsearch(const void * key, const void * base, size_t count,
138 size_t size, int (*comparefunction)(const void *, const void *));
140 /* Integer arithmetic functions */
141 int abs (int j);
142 long labs (long j);
143 #if defined AROS_HAVE_LONG_LONG
144 long long int llabs(long long int j);
145 #endif
147 div_t div(int numer, int denom);
148 ldiv_t ldiv(long int numer, long int denom);
149 #if defined AROS_HAVE_LONG_LONG
150 lldiv_t lldiv(long long int numer, long long int denom);
151 #endif
153 /* Multibyte character functions */
154 size_t mblen(const char *s, size_t n);
155 int mbtowc(wchar_t * restrict pwc, const char * restrict s, size_t n);
156 int wctomb(char *s, wchar_t wchar);
158 /* Multibyte string functions */
159 size_t mbstowcs(wchar_t * restrict pwcs, const char * restrict s, size_t n);
160 size_t wcstombs(char * restrict s, const wchar_t * restrict pwcs, size_t n);
162 /* Miscellaneous BSD functions */
163 int getloadavg(double loadavg[], int n);
165 /* The following are POSIX/SUS additions */
166 #if !defined(_ANSI_SOURCE)
167 long a64l(const char *);
168 #if 0 /* FIXME: not implemented */
169 char *ecvt(double, int, int *, int *);
170 char *fcvt (double, int, int *, int *);
171 #endif
172 char *gcvt(double, int, char *);
173 int getsubopt(char **, char *const *, char **);
174 int grantpt(int);
175 char *l64a(long);
176 char *mktemp(char *);
177 int mkstemp(char *);
178 char *ptsname(int);
179 char *realpath(const char *, char *);
180 void setkey(const char *);
181 int unlockpt(int);
182 #endif /* _ANSI_SOURCE */
184 __END_DECLS
186 #endif /* _STDLIB_H_ */