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