Chameleon

Chameleon Svn Source Tree

Root/branches/Bungo/i386/include/stdlib.h

1/*
2 * Copyright (c) 2000, 2002 - 2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*-
24 * Copyright (c) 1990, 1993
25 *The Regents of the University of California. All rights reserved.
26 *
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
29 * are met:
30 * 1. Redistributions of source code must retain the above copyright
31 * notice, this list of conditions and the following disclaimer.
32 * 2. Redistributions in binary form must reproduce the above copyright
33 * notice, this list of conditions and the following disclaimer in the
34 * documentation and/or other materials provided with the distribution.
35 * 3. All advertising materials mentioning features or use of this software
36 * must display the following acknowledgement:
37 *This product includes software developed by the University of
38 *California, Berkeley and its contributors.
39 * 4. Neither the name of the University nor the names of its contributors
40 * may be used to endorse or promote products derived from this software
41 * without specific prior written permission.
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
44 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * SUCH DAMAGE.
54 *
55 *@(#)stdlib.h8.5 (Berkeley) 5/19/95
56 */
57
58#ifndef _STDLIB_H_
59#define _STDLIB_H_
60
61#include <sys/types.h>
62
63#ifndef_SIZE_T
64#define_SIZE_T
65/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see:
66 * _GCC_SIZE_T */
67typedef__darwin_size_tsize_t;
68#endif
69
70#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
71#ifndef _CT_RUNE_T
72#define _CT_RUNE_T
73typedef__darwin_ct_rune_tct_rune_t;
74#endif
75
76#ifndef _RUNE_T
77#define _RUNE_T
78typedef __darwin_rune_t rune_t;
79#endif
80#endif/* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
81
82#ifndef__cplusplus
83#ifndef_WCHAR_T
84#define_WCHAR_T
85typedef__darwin_wchar_twchar_t;
86#endif/* _WCHAR_T */
87#endif/* __cplusplus */
88
89typedef struct {
90int quot;/* quotient */
91int rem;/* remainder */
92} div_t;
93
94typedef struct {
95long quot;/* quotient */
96long rem;/* remainder */
97} ldiv_t;
98
99#if !__DARWIN_NO_LONG_LONG
100typedef struct {
101long long quot;
102long long rem;
103} lldiv_t;
104#endif /* !__DARWIN_NO_LONG_LONG */
105
106#ifndef NULL
107#define NULL __DARWIN_NULL
108#endif /* ! NULL */
109
110#defineEXIT_FAILURE1
111#defineEXIT_SUCCESS0
112
113#defineRAND_MAX0x7fffffff
114
115#ifdef _USE_EXTENDED_LOCALES_
116#include <_xlocale.h>
117#endif /* _USE_EXTENDED_LOCALES_ */
118
119#ifndef MB_CUR_MAX
120#ifdef _USE_EXTENDED_LOCALES_
121#defineMB_CUR_MAX(___mb_cur_max())
122#ifndef MB_CUR_MAX_L
123#defineMB_CUR_MAX_L(x)(___mb_cur_max_l(x))
124#endif /* !MB_CUR_MAX_L */
125#else /* !_USE_EXTENDED_LOCALES_ */
126extern int __mb_cur_max;
127#defineMB_CUR_MAX__mb_cur_max
128#endif /* _USE_EXTENDED_LOCALES_ */
129#endif /* MB_CUR_MAX */
130
131#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) \
132 && defined(_USE_EXTENDED_LOCALES_) && !defined(MB_CUR_MAX_L)
133#defineMB_CUR_MAX_L(x)(___mb_cur_max_l(x))
134#endif
135//Begin-Libc
136/* f must be a literal string */
137#define LIBC_ABORT(f,...)abort_report_np("%s:%s:%u: " f, __FILE__, __func__, __LINE__, ## __VA_ARGS__)
138//End-Libc
139
140__BEGIN_DECLS
141void abort(void) __dead2;
142//Begin-Libc
143__private_extern__
144void abort_report_np(const char *, ...) __dead2 __printflike(1, 2);
145//End-Libc
146int abs(int) __pure2;
147int atexit(void (*)(void));
148double atof(const char *);
149int atoi(const char *);
150long atol(const char *);
151#if !__DARWIN_NO_LONG_LONG
152long long
153 atoll(const char *);
154#endif /* !__DARWIN_NO_LONG_LONG */
155void*bsearch(const void *, const void *, size_t,
156 size_t, int (*)(const void *, const void *));
157void*calloc(size_t, size_t);
158div_t div(int, int) __pure2;
159void exit(int) __dead2;
160void free(void *);
161char*getenv(const char *);
162long labs(long) __pure2;
163ldiv_t ldiv(long, long) __pure2;
164#if !__DARWIN_NO_LONG_LONG
165long long
166 llabs(long long);
167lldiv_t lldiv(long long, long long);
168#endif /* !__DARWIN_NO_LONG_LONG */
169void*malloc(size_t);
170int mblen(const char *, size_t);
171size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
172int mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
173int posix_memalign(void **, size_t, size_t);
174void qsort(void *, size_t, size_t,
175 int (*)(const void *, const void *));
176int rand(void);
177void*realloc(void *, size_t);
178void srand(unsigned);
179double strtod(const char *, char **) __DARWIN_ALIAS(strtod);
180float strtof(const char *, char **) __DARWIN_ALIAS(strtof);
181long strtol(const char *, char **, int);
182long double
183 strtold(const char *, char **) __DARWIN_LDBL_COMPAT(strtold);
184#if !__DARWIN_NO_LONG_LONG
185long long
186 strtoll(const char *, char **, int);
187#endif /* !__DARWIN_NO_LONG_LONG */
188unsigned long
189 strtoul(const char *, char **, int);
190#if !__DARWIN_NO_LONG_LONG
191unsigned long long
192 strtoull(const char *, char **, int);
193#endif /* !__DARWIN_NO_LONG_LONG */
194//Begin-Libc
195#ifndef LIBC_ALIAS_SYSTEM
196//End-Libc
197int system(const char *) __DARWIN_ALIAS_C(system);
198//Begin-Libc
199#else /* LIBC_ALIAS_SYSTEM */
200int system(const char *) LIBC_ALIAS_C(system);
201#endif /* !LIBC_ALIAS_SYSTEM */
202//End-Libc
203size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
204int wctomb(char *, wchar_t);
205
206#ifndef _ANSI_SOURCE
207void_Exit(int) __dead2;
208long a64l(const char *);
209double drand48(void);
210char*ecvt(double, int, int *__restrict, int *__restrict); /* LEGACY */
211double erand48(unsigned short[3]);
212char*fcvt(double, int, int *__restrict, int *__restrict); /* LEGACY */
213char*gcvt(double, int, char *); /* LEGACY */
214int getsubopt(char **, char * const *, char **);
215int grantpt(int);
216#if __DARWIN_UNIX03
217char*initstate(unsigned, char *, size_t); /* no __DARWIN_ALIAS needed */
218#else /* !__DARWIN_UNIX03 */
219char*initstate(unsigned long, char *, long);
220#endif /* __DARWIN_UNIX03 */
221long jrand48(unsigned short[3]);
222char*l64a(long);
223void lcong48(unsigned short[7]);
224long lrand48(void);
225char*mktemp(char *);
226int mkstemp(char *);
227long mrand48(void);
228long nrand48(unsigned short[3]);
229int posix_openpt(int);
230char*ptsname(int);
231//Begin-Libc
232#ifndef LIBC_ALIAS_PUTENV
233//End-Libc
234int putenv(char *) __DARWIN_ALIAS(putenv);
235//Begin-Libc
236#else /* LIBC_ALIAS_PUTENV */
237int putenv(char *) LIBC_ALIAS(putenv);
238#endif /* !LIBC_ALIAS_PUTENV */
239//End-Libc
240long random(void);
241int rand_r(unsigned *);
242//Begin-Libc
243#ifdef __LIBC__
244#ifndef LIBC_ALIAS_REALPATH
245char*realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath);
246#else /* LIBC_ALIAS_REALPATH */
247#ifdef VARIANT_DARWINEXTSN
248char*realpath(const char * __restrict, char * __restrict) LIBC_EXTSN(realpath);
249#else /* !VARIANT_DARWINEXTSN */
250char*realpath(const char * __restrict, char * __restrict) LIBC_ALIAS(realpath);
251#endif /* VARIANT_DARWINEXTSN */
252#endif /* !LIBC_ALIAS_REALPATH */
253#else /* !__LIBC__ */
254//End-Libc
255#if (__DARWIN_UNIX03 && !defined(_POSIX_C_SOURCE)) || defined(_DARWIN_C_SOURCE) || defined(_DARWIN_BETTER_REALPATH)
256char*realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath);
257#else /* (!__DARWIN_UNIX03 || _POSIX_C_SOURCE) && !_DARWIN_C_SOURCE && !_DARWIN_BETTER_REALPATH */
258char*realpath(const char * __restrict, char * __restrict) __DARWIN_ALIAS(realpath);
259#endif /* (__DARWIN_UNIX03 && _POSIX_C_SOURCE) || _DARWIN_C_SOURCE || _DARWIN_BETTER_REALPATH */
260//Begin-Libc
261#endif /* __LIBC__ */
262//End-Libc
263unsigned short
264*seed48(unsigned short[3]);
265//Begin-Libc
266#ifndef LIBC_ALIAS_SETENV
267//End-Libc
268int setenv(const char *, const char *, int) __DARWIN_ALIAS(setenv);
269//Begin-Libc
270#else /* LIBC_ALIAS_SETENV */
271int setenv(const char *, const char *, int) LIBC_ALIAS(setenv);
272#endif /* !LIBC_ALIAS_SETENV */
273//End-Libc
274#if __DARWIN_UNIX03
275//Begin-Libc
276#ifndef LIBC_ALIAS_SETKEY
277//End-Libc
278void setkey(const char *) __DARWIN_ALIAS(setkey);
279//Begin-Libc
280#else /* LIBC_ALIAS_SETKEY */
281void setkey(const char *) LIBC_ALIAS(setkey);
282#endif /* !LIBC_ALIAS_SETKEY */
283//End-Libc
284#else /* !__DARWIN_UNIX03 */
285int setkey(const char *);
286#endif /* __DARWIN_UNIX03 */
287char*setstate(const char *);
288void srand48(long);
289#if __DARWIN_UNIX03
290void srandom(unsigned);
291#else /* !__DARWIN_UNIX03 */
292void srandom(unsigned long);
293#endif /* __DARWIN_UNIX03 */
294int unlockpt(int);
295#if __DARWIN_UNIX03
296//Begin-Libc
297#ifndef LIBC_ALIAS_UNSETENV
298//End-Libc
299int unsetenv(const char *) __DARWIN_ALIAS(unsetenv);
300//Begin-Libc
301#else /* LIBC_ALIAS_UNSETENV */
302int unsetenv(const char *) LIBC_ALIAS(unsetenv);
303#endif /* !LIBC_ALIAS_UNSETENV */
304//End-Libc
305#else /* !__DARWIN_UNIX03 */
306void unsetenv(const char *);
307#endif /* __DARWIN_UNIX03 */
308#endif/* !_ANSI_SOURCE */
309
310/* Poison the following routines if -fshort-wchar is set */
311#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU
312#pragma GCC poison mbstowcs mbtowc wcstombs wctomb
313#endif
314__END_DECLS
315
316#ifdef _USE_EXTENDED_LOCALES_
317#include <xlocale/_stdlib.h>
318#endif /* _USE_EXTENDED_LOCALES_ */
319
320#endif /* _STDLIB_H_ */
321

Archive Download this file

Revision: HEAD