1.1 --- a/epoc32/include/libc/stdlib.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/libc/stdlib.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,143 @@
1.4 -stdlib.h
1.5 +/*
1.6 +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +* Definitions for common types, variables, and functions.
1.20 +*
1.21 +*
1.22 +*/
1.23 +
1.24 +
1.25 +
1.26 +
1.27 +
1.28 +
1.29 +
1.30 +/**
1.31 + @file
1.32 + @publishedAll
1.33 + @released
1.34 +*/
1.35 +
1.36 +
1.37 +#ifndef _STDLIB_H_
1.38 +#ifdef __cplusplus
1.39 +extern "C" {
1.40 +#endif
1.41 +#define _STDLIB_H_
1.42 +
1.43 +#include "libc/_ansi.h"
1.44 +
1.45 +#define __need_size_t
1.46 +#define __need_wchar_t
1.47 +#include <stddef.h>
1.48 +
1.49 +#include <sys/reent.h>
1.50 +
1.51 +typedef struct
1.52 +{
1.53 + int quot; /* quotient */
1.54 + int rem; /* remainder */
1.55 +} div_t;
1.56 +
1.57 +#define labs abs
1.58 +#define ldiv div
1.59 +#define ldiv_t div_t
1.60 +
1.61 +#ifndef NULL
1.62 +#define NULL 0L
1.63 +#endif
1.64 +
1.65 +#define EXIT_FAILURE 1
1.66 +#define EXIT_SUCCESS 0
1.67 +#define RAND_MAX 0x7fffffff
1.68 +#define MB_CUR_MAX 3
1.69 +
1.70 +/**
1.71 +Workaround a built-in prototype in MSVC 5.0
1.72 +*/
1.73 +#define atexit _epoc32_atexit
1.74 +IMPORT_C int _epoc32_atexit (void (*_func)(void));
1.75 +
1.76 +#ifdef EKA2
1.77 +void abort (void);
1.78 +#else
1.79 +IMPORT_C void abort (void);
1.80 +#endif
1.81 +
1.82 +IMPORT_C int abs (int);
1.83 +IMPORT_C double atof (const char *_nptr) __SOFTFP;
1.84 +IMPORT_C int atoi (const char *_nptr);
1.85 +
1.86 +#define atol atoi
1.87 +IMPORT_C void* bsearch (const void * _key,
1.88 + const void * _base,
1.89 + size_t _nmemb,
1.90 + size_t _size,
1.91 + int (*_compar)(const void *, const void *));
1.92 +IMPORT_C void* calloc (size_t _nmemb, size_t _size);
1.93 +IMPORT_C div_t div (int _numer, int _denom);
1.94 +IMPORT_C void exit (int _status) _ATTRIBUTE((noreturn));
1.95 +IMPORT_C void free (void *);
1.96 +IMPORT_C char* getenv (const char *_string);
1.97 +IMPORT_C wchar_t* wgetenv (const wchar_t *_string);
1.98 +IMPORT_C void* malloc (size_t _size);
1.99 +
1.100 +IMPORT_C int mbtowc (wchar_t *pwc, const char *s, size_t n);
1.101 +IMPORT_C int wctomb (char *s, wchar_t wc);
1.102 +IMPORT_C int mbstowcs (wchar_t *pwc, const char *s, size_t n);
1.103 +IMPORT_C int wcstombs (char *s, const wchar_t *pwc, size_t n);
1.104 +IMPORT_C int mblen (const char * string, size_t size);
1.105 +
1.106 +IMPORT_C void qsort (void * _base, size_t _nmemb, size_t _size, int(*_compar)(const void *, const void *));
1.107 +IMPORT_C int rand (void);
1.108 +IMPORT_C void* realloc (void * _r, size_t _size);
1.109 +IMPORT_C void srand (unsigned _seed);
1.110 +IMPORT_C double strtod (const char *_n, char **_end_PTR) __SOFTFP;
1.111 +IMPORT_C long strtol (const char *_n, char **_end_PTR, int _base);
1.112 +IMPORT_C unsigned long strtoul (const char *_n_PTR, char **_end_PTR, int _base);
1.113 +IMPORT_C int system (const char *_string);
1.114 +IMPORT_C int wsystem (const wchar_t *_string);
1.115 +
1.116 +/**
1.117 +not STRICT ANSI, but available anyway...
1.118 +*/
1.119 +IMPORT_C int setenv (const char *_string, const char *_value, int _overwrite);
1.120 +IMPORT_C void unsetenv (const char *_name);
1.121 +IMPORT_C int wsetenv (const wchar_t *_string, const wchar_t *_value, int _overwrite);
1.122 +IMPORT_C void wunsetenv (const wchar_t *_name);
1.123 +
1.124 +#ifndef _STRICT_ANSI
1.125 +float strtodf (const char *_n, char **_end_PTR);
1.126 +float atoff (const char *_nptr);
1.127 +
1.128 +void cfree (void *, void *);
1.129 +int putenv (const char *_string);
1.130 +
1.131 +char * gcvt (double,int,char *);
1.132 +char * gcvtf (float,int,char *);
1.133 +char * fcvt (double,int,int *,int *);
1.134 +char * fcvtf (float, int,int *,int *);
1.135 +char * ecvt (double, int,int *,int *);
1.136 +char * ecvtbuf (double, int, int*, int*, char *);
1.137 +char * fcvtbuf (double, int, int*, int*, char *);
1.138 +char * ecvtf (float, int,int *,int *);
1.139 +char * dtoa (double, int, int, int *, int*, char**);
1.140 +#endif /* ! _STRICT_ANSI */
1.141 +
1.142 +/* FIX THIS: 4.10.7: Multibyte character functions are missing. */
1.143 +
1.144 +#ifdef __cplusplus
1.145 +}
1.146 +#endif
1.147 +#endif /* _STDLIB_H_ */