os/ossrv/genericopenlibs/openenvcore/include/stdlib.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*-
sl@0
     2
 * Copyright (c) 1990, 1993
sl@0
     3
sl@0
     4
 *	The Regents of the University of California.  All rights reserved.
sl@0
     5
 *
sl@0
     6
 * Redistribution and use in source and binary forms, with or without
sl@0
     7
 * modification, are permitted provided that the following conditions
sl@0
     8
 * are met:
sl@0
     9
 * 1. Redistributions of source code must retain the above copyright
sl@0
    10
 *    notice, this list of conditions and the following disclaimer.
sl@0
    11
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    12
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    13
 *    documentation and/or other materials provided with the distribution.
sl@0
    14
 * 4. Neither the name of the University nor the names of its contributors
sl@0
    15
 *    may be used to endorse or promote products derived from this software
sl@0
    16
 *    without specific prior written permission.
sl@0
    17
 *
sl@0
    18
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
sl@0
    19
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    20
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    21
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
sl@0
    22
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    23
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    24
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    25
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    26
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    27
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    28
 * SUCH DAMAGE.
sl@0
    29
 *
sl@0
    30
 *	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
sl@0
    31
 * $FreeBSD: src/include/stdlib.h,v 1.57 2005/01/09 03:55:12 tjr Exp $
sl@0
    32
 * Portions Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).All rights reserved.
sl@0
    33
 */
sl@0
    34
sl@0
    35
#ifndef _STDLIB_H_
sl@0
    36
#define	_STDLIB_H_
sl@0
    37
sl@0
    38
//---
sl@0
    39
#ifdef __cplusplus
sl@0
    40
#include <e32def.h>
sl@0
    41
sl@0
    42
extern "C" {
sl@0
    43
#endif
sl@0
    44
sl@0
    45
//---
sl@0
    46
#include <sys/cdefs.h>
sl@0
    47
#include <sys/_null.h>
sl@0
    48
#include <sys/_types.h>
sl@0
    49
sl@0
    50
#include <_ansi.h>
sl@0
    51
sl@0
    52
#ifdef __SYMBIAN32__
sl@0
    53
#ifdef __WINSCW__
sl@0
    54
#ifndef __SOFTFP
sl@0
    55
#define __SOFTFP
sl@0
    56
#endif /* __SOFTFP */
sl@0
    57
#endif//__WINSCW__
sl@0
    58
#endif//__SYMBIAN32__
sl@0
    59
sl@0
    60
#if __BSD_VISIBLE
sl@0
    61
#ifndef _RUNE_T_DECLARED
sl@0
    62
typedef	__rune_t	rune_t;
sl@0
    63
#define	_RUNE_T_DECLARED
sl@0
    64
#endif
sl@0
    65
#endif
sl@0
    66
sl@0
    67
#ifndef _SIZE_T_DECLARED
sl@0
    68
typedef	__size_t	size_t;
sl@0
    69
#define	_SIZE_T_DECLARED
sl@0
    70
#endif
sl@0
    71
sl@0
    72
#ifndef __SYMBIAN32__
sl@0
    73
#ifndef	__cplusplus
sl@0
    74
#ifndef _WCHAR_T_DECLARED
sl@0
    75
typedef	__wchar_t	wchar_t;
sl@0
    76
#define	_WCHAR_T_DECLARED
sl@0
    77
#endif //_WCHAR_T_DECLARED
sl@0
    78
#endif //__cplusplus
sl@0
    79
#else
sl@0
    80
//C++ built-in wchar data type which doesn't clash with the definition of wchar
sl@0
    81
#if !defined _WCHAR_T_DECLARED && defined __cplusplus && defined __WINSCW__
sl@0
    82
#if __option(wchar_type)
sl@0
    83
#define	_WCHAR_T_DECLARED
sl@0
    84
#endif //__option (wchar_type)
sl@0
    85
#endif //__WINSCW__
sl@0
    86
sl@0
    87
#if !defined _WCHAR_T_DECLARED && !defined __wchar_t_defined
sl@0
    88
#if defined __cplusplus
sl@0
    89
#if defined __WINSCW__
sl@0
    90
typedef unsigned short int wchar_t;
sl@0
    91
#define	_WCHAR_T_DECLARED
sl@0
    92
#endif // __WINSCW__
sl@0
    93
#else
sl@0
    94
typedef unsigned short int wchar_t;
sl@0
    95
#define	_WCHAR_T_DECLARED
sl@0
    96
#endif // __cplusplus 
sl@0
    97
#endif // __wchar_t_defined
sl@0
    98
#endif //__SYMBIAN32__
sl@0
    99
sl@0
   100
typedef struct {
sl@0
   101
	int	quot;		/* quotient */
sl@0
   102
	int	rem;		/* remainder */
sl@0
   103
} div_t;
sl@0
   104
sl@0
   105
typedef struct {
sl@0
   106
	long	quot;
sl@0
   107
	long	rem;
sl@0
   108
} ldiv_t;
sl@0
   109
sl@0
   110
#define	EXIT_FAILURE	1
sl@0
   111
#define	EXIT_SUCCESS	0
sl@0
   112
sl@0
   113
#define	RAND_MAX	0x7fffffff
sl@0
   114
sl@0
   115
#ifndef __SYMBIAN32__
sl@0
   116
extern int __mb_cur_max;
sl@0
   117
#define	MB_CUR_MAX	__mb_cur_max
sl@0
   118
#else
sl@0
   119
#define	MB_CUR_MAX 4
sl@0
   120
#endif
sl@0
   121
sl@0
   122
//for armv5
sl@0
   123
#define inline __inline
sl@0
   124
sl@0
   125
__BEGIN_DECLS
sl@0
   126
IMPORT_C void	 abort(void) __dead2;
sl@0
   127
IMPORT_C int	 abs(int) __pure2;
sl@0
   128
IMPORT_C int	 atexit(void (*)(void));
sl@0
   129
IMPORT_C double	 atof(const char *) __SOFTFP;
sl@0
   130
IMPORT_C int	 atoi(const char *);
sl@0
   131
IMPORT_C long	 atol(const char *);
sl@0
   132
IMPORT_C void	*bsearch(const void *, const void *, size_t,
sl@0
   133
	    size_t, int (*)(const void *, const void *));
sl@0
   134
IMPORT_C void	*calloc(size_t, size_t);
sl@0
   135
IMPORT_C div_t	 div(int, int) __pure2;
sl@0
   136
IMPORT_C void	 exit(int) __dead2;
sl@0
   137
IMPORT_C void	 free(void *);
sl@0
   138
IMPORT_C char	*getenv(const char *);
sl@0
   139
IMPORT_C long	 labs(long) __pure2;
sl@0
   140
IMPORT_C ldiv_t	 ldiv(long, long) __pure2;
sl@0
   141
IMPORT_C void	*malloc(size_t);
sl@0
   142
IMPORT_C int	 mblen(const char *, size_t);
sl@0
   143
IMPORT_C size_t	 mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
sl@0
   144
IMPORT_C int	 mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
sl@0
   145
IMPORT_C void	 qsort(void *, size_t, size_t,
sl@0
   146
	    int (*)(const void *, const void *));
sl@0
   147
IMPORT_C int	 rand(void);
sl@0
   148
IMPORT_C void	*realloc(void *, size_t);
sl@0
   149
IMPORT_C void	 srand(unsigned);
sl@0
   150
IMPORT_C double	 strtod(const char * __restrict, char ** __restrict) __SOFTFP;
sl@0
   151
sl@0
   152
IMPORT_C 
sl@0
   153
float	 strtof(const char * __restrict, char ** __restrict) __SOFTFP;
sl@0
   154
sl@0
   155
IMPORT_C long	 strtol(const char * __restrict, char ** __restrict, int);
sl@0
   156
sl@0
   157
IMPORT_C 
sl@0
   158
long double
sl@0
   159
	 strtold(const char * __restrict, char ** __restrict) __SOFTFP;
sl@0
   160
sl@0
   161
IMPORT_C
sl@0
   162
unsigned long
sl@0
   163
	 strtoul(const char * __restrict, char ** __restrict, int);
sl@0
   164
sl@0
   165
IMPORT_C int	 system(const char *);
sl@0
   166
IMPORT_C int	 wctomb(char *, wchar_t);
sl@0
   167
IMPORT_C size_t	 wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
sl@0
   168
sl@0
   169
/*
sl@0
   170
 * Functions added in C99 which we make conditionally available in the
sl@0
   171
 * BSD^C89 namespace if the compiler supports `long long'.
sl@0
   172
 * The #if test is more complicated than it ought to be because
sl@0
   173
 * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'
sl@0
   174
 * is not supported in the compilation environment (which therefore means
sl@0
   175
 * that it can't really be ISO C99).
sl@0
   176
 *
sl@0
   177
 * (The only other extension made by C99 in thie header is _Exit().)
sl@0
   178
 */
sl@0
   179
#if __ISO_C_VISIBLE >= 1999
sl@0
   180
#ifdef __LONG_LONG_SUPPORTED
sl@0
   181
/* LONGLONG */
sl@0
   182
typedef struct {
sl@0
   183
	long long quot;
sl@0
   184
	long long rem;
sl@0
   185
} lldiv_t;
sl@0
   186
sl@0
   187
/* LONGLONG */
sl@0
   188
IMPORT_C
sl@0
   189
long long
sl@0
   190
	 atoll(const char *);
sl@0
   191
sl@0
   192
/* LONGLONG */
sl@0
   193
IMPORT_C
sl@0
   194
long long
sl@0
   195
	 llabs(long long) __pure2;
sl@0
   196
sl@0
   197
/* LONGLONG */
sl@0
   198
IMPORT_C lldiv_t	 lldiv(long long, long long) __pure2;
sl@0
   199
sl@0
   200
/* LONGLONG */
sl@0
   201
IMPORT_C 
sl@0
   202
long long
sl@0
   203
	 strtoll(const char * __restrict, char ** __restrict, int);
sl@0
   204
sl@0
   205
/* LONGLONG */
sl@0
   206
IMPORT_C 
sl@0
   207
unsigned long long
sl@0
   208
	 strtoull(const char * __restrict, char ** __restrict, int);
sl@0
   209
#endif /* __LONG_LONG_SUPPORTED */
sl@0
   210
sl@0
   211
IMPORT_C void	 _Exit(int) __dead2;
sl@0
   212
#endif /* __ISO_C_VISIBLE >= 1999 */
sl@0
   213
sl@0
   214
/*
sl@0
   215
 * Extensions made by POSIX relative to C.  We don't know yet which edition
sl@0
   216
 * of POSIX made these extensions, so assume they've always been there until
sl@0
   217
 * research can be done.
sl@0
   218
 */
sl@0
   219
#if __POSIX_VISIBLE /* >= ??? */
sl@0
   220
IMPORT_C int	 setenv(const char *, const char *, int);
sl@0
   221
IMPORT_C void	 unsetenv(const char *);
sl@0
   222
#endif
sl@0
   223
sl@0
   224
/*
sl@0
   225
 * The only changes to the XSI namespace in revision 6 were the deletion
sl@0
   226
 * of the ttyslot() and valloc() functions, which FreeBSD never declared
sl@0
   227
 * in this header.  For revision 7, ecvt(), fcvt(), and gcvt(), which
sl@0
   228
 * FreeBSD also does not have, and mktemp(), are to be deleted.
sl@0
   229
 */
sl@0
   230
#if __XSI_VISIBLE
sl@0
   231
/* XXX XSI requires pollution from <sys/wait.h> here.  We'd rather not. */
sl@0
   232
/* long	 a64l(const char *); */
sl@0
   233
#ifndef _MKSTEMP_DECLARED
sl@0
   234
IMPORT_C int	 mkstemp(char *);
sl@0
   235
sl@0
   236
#if defined(SYMBIAN_OE_LARGE_FILE_SUPPORT) && !defined(SYMBIAN_OE_NO_LFS)
sl@0
   237
#define mkstemp64 mkstemp
sl@0
   238
#endif /* SYMBIAN_OE_LARGE_FILE_SUPPORT && !SYMBIAN_OE_NO_LFS */
sl@0
   239
sl@0
   240
#define	_MKSTEMP_DECLARED
sl@0
   241
#endif
sl@0
   242
IMPORT_C int	 putenv(const char *);
sl@0
   243
IMPORT_C long	 random(void);
sl@0
   244
IMPORT_C void	 srandom(unsigned long);
sl@0
   245
IMPORT_C char	*realpath(const char *, char resolved_path[]);
sl@0
   246
IMPORT_C char	*setstate(/* const */ char *);
sl@0
   247
IMPORT_C char	*initstate(unsigned long /* XSI requires u_int */, char *, long);
sl@0
   248
#ifndef _SETKEY_DECLARED
sl@0
   249
int	 setkey(const char *);
sl@0
   250
#define	_SETKEY_DECLARED
sl@0
   251
#endif
sl@0
   252
#endif /* __XSI_VISIBLE */
sl@0
   253
sl@0
   254
#if __BSD_VISIBLE
sl@0
   255
extern const char *_malloc_options;
sl@0
   256
extern void (*_malloc_message)(const char *, const char *, const char *,
sl@0
   257
	    const char *);
sl@0
   258
sl@0
   259
sl@0
   260
__uint32_t
sl@0
   261
	 arc4random(void);
sl@0
   262
IMPORT_C const char *	 getprogname(void);
sl@0
   263
IMPORT_C void    *reallocf(void *, size_t);
sl@0
   264
IMPORT_C void	 setprogname(const char *);
sl@0
   265
sl@0
   266
#ifdef __SYMBIAN_COMPILE_UNUSED__
sl@0
   267
void	 sranddev(void);
sl@0
   268
void	 srandomdev(void);
sl@0
   269
#endif
sl@0
   270
/* Deprecated interfaces, to be removed in FreeBSD 6.0. */
sl@0
   271
IMPORT_C
sl@0
   272
__int64_t
sl@0
   273
	 strtoq(const char *, char **, int);
sl@0
   274
IMPORT_C
sl@0
   275
__uint64_t
sl@0
   276
	 strtouq(const char *, char **, int);
sl@0
   277
sl@0
   278
extern char *suboptarg;			/* getsubopt(3) external variable */
sl@0
   279
#endif /* __BSD_VISIBLE */
sl@0
   280
sl@0
   281
#ifdef __SYMBIAN32__ /* For libcrypt library */
sl@0
   282
#ifndef _SETKEY_DECLARED
sl@0
   283
void setkey(const char *key);
sl@0
   284
#endif
sl@0
   285
#endif
sl@0
   286
__END_DECLS
sl@0
   287
sl@0
   288
//---
sl@0
   289
#ifdef __cplusplus
sl@0
   290
}
sl@0
   291
#endif
sl@0
   292
//---
sl@0
   293
sl@0
   294
#endif /* !_STDLIB_H_ */