os/ossrv/genericopenlibs/openenvcore/include/stdlib.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/stdlib.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,294 @@
     1.4 +/*-
     1.5 + * Copyright (c) 1990, 1993
     1.6 +
     1.7 + *	The Regents of the University of California.  All rights reserved.
     1.8 + *
     1.9 + * Redistribution and use in source and binary forms, with or without
    1.10 + * modification, are permitted provided that the following conditions
    1.11 + * are met:
    1.12 + * 1. Redistributions of source code must retain the above copyright
    1.13 + *    notice, this list of conditions and the following disclaimer.
    1.14 + * 2. Redistributions in binary form must reproduce the above copyright
    1.15 + *    notice, this list of conditions and the following disclaimer in the
    1.16 + *    documentation and/or other materials provided with the distribution.
    1.17 + * 4. Neither the name of the University nor the names of its contributors
    1.18 + *    may be used to endorse or promote products derived from this software
    1.19 + *    without specific prior written permission.
    1.20 + *
    1.21 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    1.22 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.23 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.24 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    1.25 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.26 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    1.27 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.28 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.29 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    1.30 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.31 + * SUCH DAMAGE.
    1.32 + *
    1.33 + *	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
    1.34 + * $FreeBSD: src/include/stdlib.h,v 1.57 2005/01/09 03:55:12 tjr Exp $
    1.35 + * Portions Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).All rights reserved.
    1.36 + */
    1.37 +
    1.38 +#ifndef _STDLIB_H_
    1.39 +#define	_STDLIB_H_
    1.40 +
    1.41 +//---
    1.42 +#ifdef __cplusplus
    1.43 +#include <e32def.h>
    1.44 +
    1.45 +extern "C" {
    1.46 +#endif
    1.47 +
    1.48 +//---
    1.49 +#include <sys/cdefs.h>
    1.50 +#include <sys/_null.h>
    1.51 +#include <sys/_types.h>
    1.52 +
    1.53 +#include <_ansi.h>
    1.54 +
    1.55 +#ifdef __SYMBIAN32__
    1.56 +#ifdef __WINSCW__
    1.57 +#ifndef __SOFTFP
    1.58 +#define __SOFTFP
    1.59 +#endif /* __SOFTFP */
    1.60 +#endif//__WINSCW__
    1.61 +#endif//__SYMBIAN32__
    1.62 +
    1.63 +#if __BSD_VISIBLE
    1.64 +#ifndef _RUNE_T_DECLARED
    1.65 +typedef	__rune_t	rune_t;
    1.66 +#define	_RUNE_T_DECLARED
    1.67 +#endif
    1.68 +#endif
    1.69 +
    1.70 +#ifndef _SIZE_T_DECLARED
    1.71 +typedef	__size_t	size_t;
    1.72 +#define	_SIZE_T_DECLARED
    1.73 +#endif
    1.74 +
    1.75 +#ifndef __SYMBIAN32__
    1.76 +#ifndef	__cplusplus
    1.77 +#ifndef _WCHAR_T_DECLARED
    1.78 +typedef	__wchar_t	wchar_t;
    1.79 +#define	_WCHAR_T_DECLARED
    1.80 +#endif //_WCHAR_T_DECLARED
    1.81 +#endif //__cplusplus
    1.82 +#else
    1.83 +//C++ built-in wchar data type which doesn't clash with the definition of wchar
    1.84 +#if !defined _WCHAR_T_DECLARED && defined __cplusplus && defined __WINSCW__
    1.85 +#if __option(wchar_type)
    1.86 +#define	_WCHAR_T_DECLARED
    1.87 +#endif //__option (wchar_type)
    1.88 +#endif //__WINSCW__
    1.89 +
    1.90 +#if !defined _WCHAR_T_DECLARED && !defined __wchar_t_defined
    1.91 +#if defined __cplusplus
    1.92 +#if defined __WINSCW__
    1.93 +typedef unsigned short int wchar_t;
    1.94 +#define	_WCHAR_T_DECLARED
    1.95 +#endif // __WINSCW__
    1.96 +#else
    1.97 +typedef unsigned short int wchar_t;
    1.98 +#define	_WCHAR_T_DECLARED
    1.99 +#endif // __cplusplus 
   1.100 +#endif // __wchar_t_defined
   1.101 +#endif //__SYMBIAN32__
   1.102 +
   1.103 +typedef struct {
   1.104 +	int	quot;		/* quotient */
   1.105 +	int	rem;		/* remainder */
   1.106 +} div_t;
   1.107 +
   1.108 +typedef struct {
   1.109 +	long	quot;
   1.110 +	long	rem;
   1.111 +} ldiv_t;
   1.112 +
   1.113 +#define	EXIT_FAILURE	1
   1.114 +#define	EXIT_SUCCESS	0
   1.115 +
   1.116 +#define	RAND_MAX	0x7fffffff
   1.117 +
   1.118 +#ifndef __SYMBIAN32__
   1.119 +extern int __mb_cur_max;
   1.120 +#define	MB_CUR_MAX	__mb_cur_max
   1.121 +#else
   1.122 +#define	MB_CUR_MAX 4
   1.123 +#endif
   1.124 +
   1.125 +//for armv5
   1.126 +#define inline __inline
   1.127 +
   1.128 +__BEGIN_DECLS
   1.129 +IMPORT_C void	 abort(void) __dead2;
   1.130 +IMPORT_C int	 abs(int) __pure2;
   1.131 +IMPORT_C int	 atexit(void (*)(void));
   1.132 +IMPORT_C double	 atof(const char *) __SOFTFP;
   1.133 +IMPORT_C int	 atoi(const char *);
   1.134 +IMPORT_C long	 atol(const char *);
   1.135 +IMPORT_C void	*bsearch(const void *, const void *, size_t,
   1.136 +	    size_t, int (*)(const void *, const void *));
   1.137 +IMPORT_C void	*calloc(size_t, size_t);
   1.138 +IMPORT_C div_t	 div(int, int) __pure2;
   1.139 +IMPORT_C void	 exit(int) __dead2;
   1.140 +IMPORT_C void	 free(void *);
   1.141 +IMPORT_C char	*getenv(const char *);
   1.142 +IMPORT_C long	 labs(long) __pure2;
   1.143 +IMPORT_C ldiv_t	 ldiv(long, long) __pure2;
   1.144 +IMPORT_C void	*malloc(size_t);
   1.145 +IMPORT_C int	 mblen(const char *, size_t);
   1.146 +IMPORT_C size_t	 mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
   1.147 +IMPORT_C int	 mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
   1.148 +IMPORT_C void	 qsort(void *, size_t, size_t,
   1.149 +	    int (*)(const void *, const void *));
   1.150 +IMPORT_C int	 rand(void);
   1.151 +IMPORT_C void	*realloc(void *, size_t);
   1.152 +IMPORT_C void	 srand(unsigned);
   1.153 +IMPORT_C double	 strtod(const char * __restrict, char ** __restrict) __SOFTFP;
   1.154 +
   1.155 +IMPORT_C 
   1.156 +float	 strtof(const char * __restrict, char ** __restrict) __SOFTFP;
   1.157 +
   1.158 +IMPORT_C long	 strtol(const char * __restrict, char ** __restrict, int);
   1.159 +
   1.160 +IMPORT_C 
   1.161 +long double
   1.162 +	 strtold(const char * __restrict, char ** __restrict) __SOFTFP;
   1.163 +
   1.164 +IMPORT_C
   1.165 +unsigned long
   1.166 +	 strtoul(const char * __restrict, char ** __restrict, int);
   1.167 +
   1.168 +IMPORT_C int	 system(const char *);
   1.169 +IMPORT_C int	 wctomb(char *, wchar_t);
   1.170 +IMPORT_C size_t	 wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
   1.171 +
   1.172 +/*
   1.173 + * Functions added in C99 which we make conditionally available in the
   1.174 + * BSD^C89 namespace if the compiler supports `long long'.
   1.175 + * The #if test is more complicated than it ought to be because
   1.176 + * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'
   1.177 + * is not supported in the compilation environment (which therefore means
   1.178 + * that it can't really be ISO C99).
   1.179 + *
   1.180 + * (The only other extension made by C99 in thie header is _Exit().)
   1.181 + */
   1.182 +#if __ISO_C_VISIBLE >= 1999
   1.183 +#ifdef __LONG_LONG_SUPPORTED
   1.184 +/* LONGLONG */
   1.185 +typedef struct {
   1.186 +	long long quot;
   1.187 +	long long rem;
   1.188 +} lldiv_t;
   1.189 +
   1.190 +/* LONGLONG */
   1.191 +IMPORT_C
   1.192 +long long
   1.193 +	 atoll(const char *);
   1.194 +
   1.195 +/* LONGLONG */
   1.196 +IMPORT_C
   1.197 +long long
   1.198 +	 llabs(long long) __pure2;
   1.199 +
   1.200 +/* LONGLONG */
   1.201 +IMPORT_C lldiv_t	 lldiv(long long, long long) __pure2;
   1.202 +
   1.203 +/* LONGLONG */
   1.204 +IMPORT_C 
   1.205 +long long
   1.206 +	 strtoll(const char * __restrict, char ** __restrict, int);
   1.207 +
   1.208 +/* LONGLONG */
   1.209 +IMPORT_C 
   1.210 +unsigned long long
   1.211 +	 strtoull(const char * __restrict, char ** __restrict, int);
   1.212 +#endif /* __LONG_LONG_SUPPORTED */
   1.213 +
   1.214 +IMPORT_C void	 _Exit(int) __dead2;
   1.215 +#endif /* __ISO_C_VISIBLE >= 1999 */
   1.216 +
   1.217 +/*
   1.218 + * Extensions made by POSIX relative to C.  We don't know yet which edition
   1.219 + * of POSIX made these extensions, so assume they've always been there until
   1.220 + * research can be done.
   1.221 + */
   1.222 +#if __POSIX_VISIBLE /* >= ??? */
   1.223 +IMPORT_C int	 setenv(const char *, const char *, int);
   1.224 +IMPORT_C void	 unsetenv(const char *);
   1.225 +#endif
   1.226 +
   1.227 +/*
   1.228 + * The only changes to the XSI namespace in revision 6 were the deletion
   1.229 + * of the ttyslot() and valloc() functions, which FreeBSD never declared
   1.230 + * in this header.  For revision 7, ecvt(), fcvt(), and gcvt(), which
   1.231 + * FreeBSD also does not have, and mktemp(), are to be deleted.
   1.232 + */
   1.233 +#if __XSI_VISIBLE
   1.234 +/* XXX XSI requires pollution from <sys/wait.h> here.  We'd rather not. */
   1.235 +/* long	 a64l(const char *); */
   1.236 +#ifndef _MKSTEMP_DECLARED
   1.237 +IMPORT_C int	 mkstemp(char *);
   1.238 +
   1.239 +#if defined(SYMBIAN_OE_LARGE_FILE_SUPPORT) && !defined(SYMBIAN_OE_NO_LFS)
   1.240 +#define mkstemp64 mkstemp
   1.241 +#endif /* SYMBIAN_OE_LARGE_FILE_SUPPORT && !SYMBIAN_OE_NO_LFS */
   1.242 +
   1.243 +#define	_MKSTEMP_DECLARED
   1.244 +#endif
   1.245 +IMPORT_C int	 putenv(const char *);
   1.246 +IMPORT_C long	 random(void);
   1.247 +IMPORT_C void	 srandom(unsigned long);
   1.248 +IMPORT_C char	*realpath(const char *, char resolved_path[]);
   1.249 +IMPORT_C char	*setstate(/* const */ char *);
   1.250 +IMPORT_C char	*initstate(unsigned long /* XSI requires u_int */, char *, long);
   1.251 +#ifndef _SETKEY_DECLARED
   1.252 +int	 setkey(const char *);
   1.253 +#define	_SETKEY_DECLARED
   1.254 +#endif
   1.255 +#endif /* __XSI_VISIBLE */
   1.256 +
   1.257 +#if __BSD_VISIBLE
   1.258 +extern const char *_malloc_options;
   1.259 +extern void (*_malloc_message)(const char *, const char *, const char *,
   1.260 +	    const char *);
   1.261 +
   1.262 +
   1.263 +__uint32_t
   1.264 +	 arc4random(void);
   1.265 +IMPORT_C const char *	 getprogname(void);
   1.266 +IMPORT_C void    *reallocf(void *, size_t);
   1.267 +IMPORT_C void	 setprogname(const char *);
   1.268 +
   1.269 +#ifdef __SYMBIAN_COMPILE_UNUSED__
   1.270 +void	 sranddev(void);
   1.271 +void	 srandomdev(void);
   1.272 +#endif
   1.273 +/* Deprecated interfaces, to be removed in FreeBSD 6.0. */
   1.274 +IMPORT_C
   1.275 +__int64_t
   1.276 +	 strtoq(const char *, char **, int);
   1.277 +IMPORT_C
   1.278 +__uint64_t
   1.279 +	 strtouq(const char *, char **, int);
   1.280 +
   1.281 +extern char *suboptarg;			/* getsubopt(3) external variable */
   1.282 +#endif /* __BSD_VISIBLE */
   1.283 +
   1.284 +#ifdef __SYMBIAN32__ /* For libcrypt library */
   1.285 +#ifndef _SETKEY_DECLARED
   1.286 +void setkey(const char *key);
   1.287 +#endif
   1.288 +#endif
   1.289 +__END_DECLS
   1.290 +
   1.291 +//---
   1.292 +#ifdef __cplusplus
   1.293 +}
   1.294 +#endif
   1.295 +//---
   1.296 +
   1.297 +#endif /* !_STDLIB_H_ */