epoc32/include/libc/stdlib.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 stdlib.h
     1 /*
       
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * 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
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Definitions for common types, variables, and functions.
       
    16 * 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 /**
       
    27  @file
       
    28  @publishedAll
       
    29  @released
       
    30 */
       
    31 
       
    32 
       
    33 #ifndef _STDLIB_H_
       
    34 #ifdef __cplusplus
       
    35 extern "C" {
       
    36 #endif
       
    37 #define _STDLIB_H_
       
    38 
       
    39 #include "libc/_ansi.h"
       
    40 
       
    41 #define __need_size_t
       
    42 #define __need_wchar_t
       
    43 #include <stddef.h>
       
    44 
       
    45 #include <sys/reent.h>
       
    46 
       
    47 typedef struct 
       
    48 {
       
    49   int quot; /* quotient */
       
    50   int rem; /* remainder */
       
    51 } div_t;
       
    52 
       
    53 #define	labs abs
       
    54 #define	ldiv div
       
    55 #define ldiv_t div_t
       
    56 
       
    57 #ifndef NULL
       
    58 #define NULL 0L
       
    59 #endif
       
    60 
       
    61 #define EXIT_FAILURE 1
       
    62 #define EXIT_SUCCESS 0
       
    63 #define RAND_MAX 0x7fffffff
       
    64 #define MB_CUR_MAX 3
       
    65 
       
    66 /** 
       
    67 Workaround a built-in prototype in MSVC 5.0 
       
    68 */
       
    69 #define atexit	_epoc32_atexit
       
    70 IMPORT_C int	_epoc32_atexit	(void (*_func)(void));
       
    71 
       
    72 #ifdef EKA2
       
    73 void	abort	(void);
       
    74 #else
       
    75 IMPORT_C void	abort	(void);
       
    76 #endif
       
    77 
       
    78 IMPORT_C int	abs		(int);
       
    79 IMPORT_C double	atof	(const char *_nptr) __SOFTFP;
       
    80 IMPORT_C int	atoi	(const char *_nptr);
       
    81 
       
    82 #define atol	atoi
       
    83 IMPORT_C void*	bsearch	(const void * _key,
       
    84 		       const void * _base,
       
    85 		       size_t _nmemb,
       
    86 		       size_t _size,
       
    87 		       int (*_compar)(const void *, const void *));
       
    88 IMPORT_C void*	calloc	(size_t _nmemb, size_t _size);
       
    89 IMPORT_C div_t	div	(int _numer, int _denom);
       
    90 IMPORT_C void	exit	(int _status) _ATTRIBUTE((noreturn));
       
    91 IMPORT_C void	free	(void *);
       
    92 IMPORT_C char*  getenv	(const char *_string);
       
    93 IMPORT_C wchar_t*  wgetenv	(const wchar_t *_string);
       
    94 IMPORT_C void*	malloc	(size_t _size);
       
    95 
       
    96 IMPORT_C int	mbtowc	 (wchar_t *pwc, const char *s, size_t n);
       
    97 IMPORT_C int	wctomb	 (char *s, wchar_t wc);
       
    98 IMPORT_C int	mbstowcs (wchar_t *pwc, const char *s, size_t n);
       
    99 IMPORT_C int	wcstombs (char *s, const wchar_t *pwc, size_t n);
       
   100 IMPORT_C int    mblen    (const char * string, size_t size);
       
   101 
       
   102 IMPORT_C void	qsort	(void * _base, size_t _nmemb, size_t _size, int(*_compar)(const void *, const void *));
       
   103 IMPORT_C int	rand	(void);
       
   104 IMPORT_C void*	realloc	(void * _r, size_t _size);
       
   105 IMPORT_C void	srand	(unsigned _seed);
       
   106 IMPORT_C double	strtod	(const char *_n, char **_end_PTR) __SOFTFP;
       
   107 IMPORT_C long	strtol	(const char *_n, char **_end_PTR, int _base);
       
   108 IMPORT_C unsigned long strtoul		(const char *_n_PTR, char **_end_PTR, int _base);
       
   109 IMPORT_C int	system	(const char *_string);
       
   110 IMPORT_C int	wsystem	(const wchar_t *_string);
       
   111 
       
   112 /** 
       
   113 not STRICT ANSI, but available anyway... 
       
   114 */
       
   115 IMPORT_C int	setenv	(const char *_string, const char *_value, int _overwrite);
       
   116 IMPORT_C void	unsetenv (const char *_name);
       
   117 IMPORT_C int	wsetenv	(const wchar_t *_string, const wchar_t *_value, int _overwrite);
       
   118 IMPORT_C void	wunsetenv (const wchar_t *_name);
       
   119 
       
   120 #ifndef _STRICT_ANSI
       
   121 float	strtodf	(const char *_n, char **_end_PTR);
       
   122 float	atoff	(const char *_nptr);
       
   123 
       
   124 void	cfree	(void *, void *);
       
   125 int	putenv	(const char *_string);
       
   126 
       
   127 char *	gcvt	(double,int,char *);
       
   128 char *	gcvtf	(float,int,char *);
       
   129 char *	fcvt	(double,int,int *,int *);
       
   130 char *	fcvtf	(float, int,int *,int *);
       
   131 char *	ecvt	(double, int,int *,int *);
       
   132 char *	ecvtbuf	(double, int, int*, int*, char *);
       
   133 char *	fcvtbuf	(double, int, int*, int*, char *);
       
   134 char *	ecvtf	(float, int,int *,int *);
       
   135 char *	dtoa	(double, int, int, int *, int*, char**);
       
   136 #endif /* ! _STRICT_ANSI */
       
   137 
       
   138 /* FIX THIS: 4.10.7: Multibyte character functions are missing.  */
       
   139 
       
   140 #ifdef __cplusplus
       
   141 }
       
   142 #endif
       
   143 #endif /* _STDLIB_H_ */