sl@0: /*- sl@0: * Copyright (c) 1990, 1993 sl@0: sl@0: * The Regents of the University of California. All rights reserved. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the above copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 4. Neither the name of the University nor the names of its contributors sl@0: * may be used to endorse or promote products derived from this software sl@0: * without specific prior written permission. sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: * sl@0: * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 sl@0: * $FreeBSD: src/include/stdlib.h,v 1.57 2005/01/09 03:55:12 tjr Exp $ sl@0: * Portions Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).All rights reserved. sl@0: */ sl@0: sl@0: #ifndef _STDLIB_H_ sl@0: #define _STDLIB_H_ sl@0: sl@0: //--- sl@0: #ifdef __cplusplus sl@0: #include sl@0: sl@0: extern "C" { sl@0: #endif sl@0: sl@0: //--- sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include <_ansi.h> sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: #ifdef __WINSCW__ sl@0: #ifndef __SOFTFP sl@0: #define __SOFTFP sl@0: #endif /* __SOFTFP */ sl@0: #endif//__WINSCW__ sl@0: #endif//__SYMBIAN32__ sl@0: sl@0: #if __BSD_VISIBLE sl@0: #ifndef _RUNE_T_DECLARED sl@0: typedef __rune_t rune_t; sl@0: #define _RUNE_T_DECLARED sl@0: #endif sl@0: #endif sl@0: sl@0: #ifndef _SIZE_T_DECLARED sl@0: typedef __size_t size_t; sl@0: #define _SIZE_T_DECLARED sl@0: #endif sl@0: sl@0: #ifndef __SYMBIAN32__ sl@0: #ifndef __cplusplus sl@0: #ifndef _WCHAR_T_DECLARED sl@0: typedef __wchar_t wchar_t; sl@0: #define _WCHAR_T_DECLARED sl@0: #endif //_WCHAR_T_DECLARED sl@0: #endif //__cplusplus sl@0: #else sl@0: //C++ built-in wchar data type which doesn't clash with the definition of wchar sl@0: #if !defined _WCHAR_T_DECLARED && defined __cplusplus && defined __WINSCW__ sl@0: #if __option(wchar_type) sl@0: #define _WCHAR_T_DECLARED sl@0: #endif //__option (wchar_type) sl@0: #endif //__WINSCW__ sl@0: sl@0: #if !defined _WCHAR_T_DECLARED && !defined __wchar_t_defined sl@0: #if defined __cplusplus sl@0: #if defined __WINSCW__ sl@0: typedef unsigned short int wchar_t; sl@0: #define _WCHAR_T_DECLARED sl@0: #endif // __WINSCW__ sl@0: #else sl@0: typedef unsigned short int wchar_t; sl@0: #define _WCHAR_T_DECLARED sl@0: #endif // __cplusplus sl@0: #endif // __wchar_t_defined sl@0: #endif //__SYMBIAN32__ sl@0: sl@0: typedef struct { sl@0: int quot; /* quotient */ sl@0: int rem; /* remainder */ sl@0: } div_t; sl@0: sl@0: typedef struct { sl@0: long quot; sl@0: long rem; sl@0: } ldiv_t; sl@0: sl@0: #define EXIT_FAILURE 1 sl@0: #define EXIT_SUCCESS 0 sl@0: sl@0: #define RAND_MAX 0x7fffffff sl@0: sl@0: #ifndef __SYMBIAN32__ sl@0: extern int __mb_cur_max; sl@0: #define MB_CUR_MAX __mb_cur_max sl@0: #else sl@0: #define MB_CUR_MAX 4 sl@0: #endif sl@0: sl@0: //for armv5 sl@0: #define inline __inline sl@0: sl@0: __BEGIN_DECLS sl@0: IMPORT_C void abort(void) __dead2; sl@0: IMPORT_C int abs(int) __pure2; sl@0: IMPORT_C int atexit(void (*)(void)); sl@0: IMPORT_C double atof(const char *) __SOFTFP; sl@0: IMPORT_C int atoi(const char *); sl@0: IMPORT_C long atol(const char *); sl@0: IMPORT_C void *bsearch(const void *, const void *, size_t, sl@0: size_t, int (*)(const void *, const void *)); sl@0: IMPORT_C void *calloc(size_t, size_t); sl@0: IMPORT_C div_t div(int, int) __pure2; sl@0: IMPORT_C void exit(int) __dead2; sl@0: IMPORT_C void free(void *); sl@0: IMPORT_C char *getenv(const char *); sl@0: IMPORT_C long labs(long) __pure2; sl@0: IMPORT_C ldiv_t ldiv(long, long) __pure2; sl@0: IMPORT_C void *malloc(size_t); sl@0: IMPORT_C int mblen(const char *, size_t); sl@0: IMPORT_C size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); sl@0: IMPORT_C int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); sl@0: IMPORT_C void qsort(void *, size_t, size_t, sl@0: int (*)(const void *, const void *)); sl@0: IMPORT_C int rand(void); sl@0: IMPORT_C void *realloc(void *, size_t); sl@0: IMPORT_C void srand(unsigned); sl@0: IMPORT_C double strtod(const char * __restrict, char ** __restrict) __SOFTFP; sl@0: sl@0: IMPORT_C sl@0: float strtof(const char * __restrict, char ** __restrict) __SOFTFP; sl@0: sl@0: IMPORT_C long strtol(const char * __restrict, char ** __restrict, int); sl@0: sl@0: IMPORT_C sl@0: long double sl@0: strtold(const char * __restrict, char ** __restrict) __SOFTFP; sl@0: sl@0: IMPORT_C sl@0: unsigned long sl@0: strtoul(const char * __restrict, char ** __restrict, int); sl@0: sl@0: IMPORT_C int system(const char *); sl@0: IMPORT_C int wctomb(char *, wchar_t); sl@0: IMPORT_C size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); sl@0: sl@0: /* sl@0: * Functions added in C99 which we make conditionally available in the sl@0: * BSD^C89 namespace if the compiler supports `long long'. sl@0: * The #if test is more complicated than it ought to be because sl@0: * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long' sl@0: * is not supported in the compilation environment (which therefore means sl@0: * that it can't really be ISO C99). sl@0: * sl@0: * (The only other extension made by C99 in thie header is _Exit().) sl@0: */ sl@0: #if __ISO_C_VISIBLE >= 1999 sl@0: #ifdef __LONG_LONG_SUPPORTED sl@0: /* LONGLONG */ sl@0: typedef struct { sl@0: long long quot; sl@0: long long rem; sl@0: } lldiv_t; sl@0: sl@0: /* LONGLONG */ sl@0: IMPORT_C sl@0: long long sl@0: atoll(const char *); sl@0: sl@0: /* LONGLONG */ sl@0: IMPORT_C sl@0: long long sl@0: llabs(long long) __pure2; sl@0: sl@0: /* LONGLONG */ sl@0: IMPORT_C lldiv_t lldiv(long long, long long) __pure2; sl@0: sl@0: /* LONGLONG */ sl@0: IMPORT_C sl@0: long long sl@0: strtoll(const char * __restrict, char ** __restrict, int); sl@0: sl@0: /* LONGLONG */ sl@0: IMPORT_C sl@0: unsigned long long sl@0: strtoull(const char * __restrict, char ** __restrict, int); sl@0: #endif /* __LONG_LONG_SUPPORTED */ sl@0: sl@0: IMPORT_C void _Exit(int) __dead2; sl@0: #endif /* __ISO_C_VISIBLE >= 1999 */ sl@0: sl@0: /* sl@0: * Extensions made by POSIX relative to C. We don't know yet which edition sl@0: * of POSIX made these extensions, so assume they've always been there until sl@0: * research can be done. sl@0: */ sl@0: #if __POSIX_VISIBLE /* >= ??? */ sl@0: IMPORT_C int setenv(const char *, const char *, int); sl@0: IMPORT_C void unsetenv(const char *); sl@0: #endif sl@0: sl@0: /* sl@0: * The only changes to the XSI namespace in revision 6 were the deletion sl@0: * of the ttyslot() and valloc() functions, which FreeBSD never declared sl@0: * in this header. For revision 7, ecvt(), fcvt(), and gcvt(), which sl@0: * FreeBSD also does not have, and mktemp(), are to be deleted. sl@0: */ sl@0: #if __XSI_VISIBLE sl@0: /* XXX XSI requires pollution from here. We'd rather not. */ sl@0: /* long a64l(const char *); */ sl@0: #ifndef _MKSTEMP_DECLARED sl@0: IMPORT_C int mkstemp(char *); sl@0: sl@0: #if defined(SYMBIAN_OE_LARGE_FILE_SUPPORT) && !defined(SYMBIAN_OE_NO_LFS) sl@0: #define mkstemp64 mkstemp sl@0: #endif /* SYMBIAN_OE_LARGE_FILE_SUPPORT && !SYMBIAN_OE_NO_LFS */ sl@0: sl@0: #define _MKSTEMP_DECLARED sl@0: #endif sl@0: IMPORT_C int putenv(const char *); sl@0: IMPORT_C long random(void); sl@0: IMPORT_C void srandom(unsigned long); sl@0: IMPORT_C char *realpath(const char *, char resolved_path[]); sl@0: IMPORT_C char *setstate(/* const */ char *); sl@0: IMPORT_C char *initstate(unsigned long /* XSI requires u_int */, char *, long); sl@0: #ifndef _SETKEY_DECLARED sl@0: int setkey(const char *); sl@0: #define _SETKEY_DECLARED sl@0: #endif sl@0: #endif /* __XSI_VISIBLE */ sl@0: sl@0: #if __BSD_VISIBLE sl@0: extern const char *_malloc_options; sl@0: extern void (*_malloc_message)(const char *, const char *, const char *, sl@0: const char *); sl@0: sl@0: sl@0: __uint32_t sl@0: arc4random(void); sl@0: IMPORT_C const char * getprogname(void); sl@0: IMPORT_C void *reallocf(void *, size_t); sl@0: IMPORT_C void setprogname(const char *); sl@0: sl@0: #ifdef __SYMBIAN_COMPILE_UNUSED__ sl@0: void sranddev(void); sl@0: void srandomdev(void); sl@0: #endif sl@0: /* Deprecated interfaces, to be removed in FreeBSD 6.0. */ sl@0: IMPORT_C sl@0: __int64_t sl@0: strtoq(const char *, char **, int); sl@0: IMPORT_C sl@0: __uint64_t sl@0: strtouq(const char *, char **, int); sl@0: sl@0: extern char *suboptarg; /* getsubopt(3) external variable */ sl@0: #endif /* __BSD_VISIBLE */ sl@0: sl@0: #ifdef __SYMBIAN32__ /* For libcrypt library */ sl@0: #ifndef _SETKEY_DECLARED sl@0: void setkey(const char *key); sl@0: #endif sl@0: #endif sl@0: __END_DECLS sl@0: sl@0: //--- sl@0: #ifdef __cplusplus sl@0: } sl@0: #endif sl@0: //--- sl@0: sl@0: #endif /* !_STDLIB_H_ */