stdlib.h

Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 1990, 1993
00003  *      The Regents of the University of California.  All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. All advertising materials mentioning features or use of this software
00014  *    must display the following acknowledgement:
00015  *      This product includes software developed by the University of
00016  *      California, Berkeley and its contributors.
00017  * 4. Neither the name of the University nor the names of its contributors
00018  *    may be used to endorse or promote products derived from this software
00019  *    without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00022  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00024  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00025  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00026  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00027  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00028  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00029  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00030  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  *      @(#)stdlib.h    8.5 (Berkeley) 5/19/95
00034  * $FreeBSD: src/include/stdlib.h,v 1.57 2005/01/09 03:55:12 tjr Exp $
00035  * © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved.
00036  * © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
00037  */
00038 
00039 #ifndef _STDLIB_H_
00040 #define _STDLIB_H_
00041 
00042 //---
00043 #ifdef __cplusplus
00044 #include <e32def.h>
00045 
00046 extern "C" {
00047 #endif
00048 
00049 //---
00050 #include <sys/cdefs.h>
00051 #include <sys/_null.h>
00052 #include <sys/_types.h>
00053 
00054 #include <_ansi.h>
00055 
00056 #if __BSD_VISIBLE
00057 #ifndef _RUNE_T_DECLARED
00058 typedef __rune_t        rune_t;
00059 #define _RUNE_T_DECLARED
00060 #endif
00061 #endif
00062 
00063 #ifndef _SIZE_T_DECLARED
00064 typedef __size_t        size_t;
00065 #define _SIZE_T_DECLARED
00066 #endif
00067 
00068 #ifndef __SYMBIAN32__
00069 #ifndef __cplusplus
00070 #ifndef _WCHAR_T_DECLARED
00071 typedef __wchar_t       wchar_t;
00072 #define _WCHAR_T_DECLARED
00073 //_WCHAR_T_DECLARED
00074 #endif
00075 //__cplusplus
00076 #endif
00077 #else
00078 #if !defined _WCHAR_T_DECLARED && !defined __wchar_t_defined
00079 typedef unsigned short int wchar_t;
00080 #define _WCHAR_T_DECLARED
00081 //__wchar_t_defined
00082 #endif
00083 //__SYMBIAN32__
00084 #endif
00085 
00086 typedef struct {
00087         int     quot;           /* quotient */
00088         int     rem;            /* remainder */
00089 } div_t;
00090 
00091 typedef struct {
00092         long    quot;
00093         long    rem;
00094 } ldiv_t;
00095 
00096 #define EXIT_FAILURE    1
00097 #define EXIT_SUCCESS    0
00098 
00099 #define RAND_MAX        0x7fffffff
00100 
00101 #ifndef __SYMBIAN32__
00102 extern int __mb_cur_max;
00103 #define MB_CUR_MAX      __mb_cur_max
00104 #else
00105 #define MB_CUR_MAX 4
00106 #endif
00107 
00108 //for armv5
00109 #define inline __inline
00110 
00111 __BEGIN_DECLS
00112 IMPORT_C void    abort(void) __dead2;
00113 IMPORT_C int     abs(int) __pure2;
00114 IMPORT_C int     atexit(void (*)(void));
00115 IMPORT_C double  atof(const char *);
00116 IMPORT_C int     atoi(const char *);
00117 IMPORT_C long    atol(const char *);
00118 IMPORT_C void   *bsearch(const void *, const void *, size_t,
00119             size_t, int (*)(const void *, const void *));
00120 IMPORT_C void   *calloc(size_t, size_t);
00121 IMPORT_C div_t   div(int, int) __pure2;
00122 IMPORT_C void    exit(int) __dead2;
00123 IMPORT_C void    free(void *);
00124 IMPORT_C char   *getenv(const char *);
00125 IMPORT_C long    labs(long) __pure2;
00126 IMPORT_C ldiv_t  ldiv(long, long) __pure2;
00127 IMPORT_C void   *malloc(size_t);
00128 IMPORT_C int     mblen(const char *, size_t);
00129 IMPORT_C size_t  mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
00130 IMPORT_C int     mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
00131 IMPORT_C void    qsort(void *, size_t, size_t,
00132             int (*)(const void *, const void *));
00133 IMPORT_C int     rand(void);
00134 IMPORT_C void   *realloc(void *, size_t);
00135 IMPORT_C void    srand(unsigned);
00136 IMPORT_C double  strtod(const char * __restrict, char ** __restrict);
00137 
00138 IMPORT_C 
00139 float    strtof(const char * __restrict, char ** __restrict);
00140 
00141 IMPORT_C long    strtol(const char * __restrict, char ** __restrict, int);
00142 
00143 IMPORT_C 
00144 long double
00145          strtold(const char * __restrict, char ** __restrict);
00146 
00147 IMPORT_C
00148 unsigned long
00149          strtoul(const char * __restrict, char ** __restrict, int);
00150 
00151 IMPORT_C int     system(const char *);
00152 IMPORT_C int     wctomb(char *, wchar_t);
00153 IMPORT_C size_t  wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
00154 
00155 /*
00156  * Functions added in C99 which we make conditionally available in the
00157  * BSD^C89 namespace if the compiler supports `long long'.
00158  * The #if test is more complicated than it ought to be because
00159  * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'
00160  * is not supported in the compilation environment (which therefore means
00161  * that it can't really be ISO C99).
00162  *
00163  * (The only other extension made by C99 in thie header is _Exit().)
00164  */
00165 #if __ISO_C_VISIBLE >= 1999
00166 #ifdef __LONG_LONG_SUPPORTED
00167 /* LONGLONG */
00168 typedef struct {
00169         long long quot;
00170         long long rem;
00171 } lldiv_t;
00172 
00173 /* LONGLONG */
00174 IMPORT_C
00175 long long
00176          atoll(const char *);
00177 
00178 /* LONGLONG */
00179 IMPORT_C
00180 long long
00181          llabs(long long) __pure2;
00182 
00183 /* LONGLONG */
00184 IMPORT_C lldiv_t         lldiv(long long, long long) __pure2;
00185 
00186 /* LONGLONG */
00187 IMPORT_C 
00188 long long
00189          strtoll(const char * __restrict, char ** __restrict, int);
00190 
00191 /* LONGLONG */
00192 IMPORT_C 
00193 unsigned long long
00194          strtoull(const char * __restrict, char ** __restrict, int);
00195 #endif /* __LONG_LONG_SUPPORTED */
00196 
00197 IMPORT_C void    _Exit(int) __dead2;
00198 #endif /* __ISO_C_VISIBLE >= 1999 */
00199 
00200 /*
00201  * Extensions made by POSIX relative to C.  We don't know yet which edition
00202  * of POSIX made these extensions, so assume they've always been there until
00203  * research can be done.
00204  */
00205 #if __POSIX_VISIBLE /* >= ??? */
00206 IMPORT_C int     setenv(const char *, const char *, int);
00207 IMPORT_C void    unsetenv(const char *);
00208 #endif
00209 
00210 /*
00211  * The only changes to the XSI namespace in revision 6 were the deletion
00212  * of the ttyslot() and valloc() functions, which FreeBSD never declared
00213  * in this header.  For revision 7, ecvt(), fcvt(), and gcvt(), which
00214  * FreeBSD also does not have, and mktemp(), are to be deleted.
00215  */
00216 #if __XSI_VISIBLE
00217 /* XXX XSI requires pollution from <sys/wait.h> here.  We'd rather not. */
00218 /* long  a64l(const char *); */
00219 #ifndef _MKSTEMP_DECLARED
00220 IMPORT_C int     mkstemp(char *);
00221 #define _MKSTEMP_DECLARED
00222 #endif
00223 IMPORT_C int     putenv(const char *);
00224 IMPORT_C long    random(void);
00225 IMPORT_C void    srandom(unsigned long);
00226 IMPORT_C char   *realpath(const char *, char resolved_path[]);
00227 IMPORT_C char   *setstate(/* const */ char *);
00228 IMPORT_C char   *initstate(unsigned long /* XSI requires u_int */, char *, long);
00229 #ifndef _SETKEY_DECLARED
00230 int      setkey(const char *);
00231 #define _SETKEY_DECLARED
00232 #endif
00233 #endif /* __XSI_VISIBLE */
00234 
00235 #if __BSD_VISIBLE
00236 extern const char *_malloc_options;
00237 extern void (*_malloc_message)(const char *, const char *, const char *,
00238             const char *);
00239 
00240 
00241 __uint32_t
00242          arc4random(void);
00243 IMPORT_C const char *    getprogname(void);
00244 IMPORT_C void    *reallocf(void *, size_t);
00245 IMPORT_C void    setprogname(const char *);
00246 
00247 /* Deprecated interfaces, to be removed in FreeBSD 6.0. */
00248 IMPORT_C
00249 __int64_t
00250          strtoq(const char *, char **, int);
00251 IMPORT_C
00252 __uint64_t
00253          strtouq(const char *, char **, int);
00254 
00255 extern char *suboptarg;                 /* getsubopt(3) external variable */
00256 #endif /* __BSD_VISIBLE */
00257 
00258 #ifdef __SYMBIAN32__ /* For libcrypt library */
00259 #ifndef _SETKEY_DECLARED
00260 void setkey(const char *key);
00261 #endif
00262 #endif
00263 __END_DECLS
00264 
00265 //---
00266 #ifdef __cplusplus
00267 }
00268 #endif
00269 //---
00270 
00271 #endif /* !_STDLIB_H_ */

Copyright © Nokia Corporation 2001-2008
Back to top