sl@0: /* sl@0: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Definitions for common types, variables, and functions. sl@0: * sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: sl@0: sl@0: #ifndef _STDLIB_H_ sl@0: #ifdef __cplusplus sl@0: extern "C" { sl@0: #endif sl@0: #define _STDLIB_H_ sl@0: sl@0: #include "libc/_ansi.h" sl@0: sl@0: #define __need_size_t sl@0: #define __need_wchar_t sl@0: #include sl@0: sl@0: #include sl@0: sl@0: typedef struct sl@0: { sl@0: int quot; /* quotient */ sl@0: int rem; /* remainder */ sl@0: } div_t; sl@0: sl@0: #define labs abs sl@0: #define ldiv div sl@0: #define ldiv_t div_t sl@0: sl@0: #ifndef NULL sl@0: #define NULL 0L sl@0: #endif sl@0: sl@0: #define EXIT_FAILURE 1 sl@0: #define EXIT_SUCCESS 0 sl@0: #define RAND_MAX 0x7fffffff sl@0: #define MB_CUR_MAX 3 sl@0: sl@0: /** sl@0: Workaround a built-in prototype in MSVC 5.0 sl@0: */ sl@0: #define atexit _epoc32_atexit sl@0: IMPORT_C int _epoc32_atexit (void (*_func)(void)); sl@0: sl@0: #ifdef EKA2 sl@0: IMPORT_C void abort (void); sl@0: #else sl@0: IMPORT_C void abort (void); sl@0: #endif sl@0: sl@0: IMPORT_C int abs (int); sl@0: IMPORT_C double atof (const char *_nptr) __SOFTFP; sl@0: IMPORT_C int atoi (const char *_nptr); sl@0: sl@0: #define atol atoi sl@0: IMPORT_C void* bsearch (const void * _key, sl@0: const void * _base, sl@0: size_t _nmemb, sl@0: size_t _size, sl@0: int (*_compar)(const void *, const void *)); sl@0: IMPORT_C void* calloc (size_t _nmemb, size_t _size); sl@0: IMPORT_C div_t div (int _numer, int _denom); sl@0: IMPORT_C void exit (int _status) _ATTRIBUTE((noreturn)); sl@0: IMPORT_C void free (void *); sl@0: IMPORT_C char* getenv (const char *_string); sl@0: IMPORT_C wchar_t* wgetenv (const wchar_t *_string); sl@0: IMPORT_C void* malloc (size_t _size); sl@0: sl@0: IMPORT_C int mbtowc (wchar_t *pwc, const char *s, size_t n); sl@0: IMPORT_C int wctomb (char *s, wchar_t wc); sl@0: IMPORT_C int mbstowcs (wchar_t *pwc, const char *s, size_t n); sl@0: IMPORT_C int wcstombs (char *s, const wchar_t *pwc, size_t n); sl@0: IMPORT_C int mblen (const char * string, size_t size); sl@0: sl@0: IMPORT_C void qsort (void * _base, size_t _nmemb, size_t _size, int(*_compar)(const void *, const void *)); sl@0: IMPORT_C int rand (void); sl@0: IMPORT_C void* realloc (void * _r, size_t _size); sl@0: IMPORT_C void srand (unsigned _seed); sl@0: IMPORT_C double strtod (const char *_n, char **_end_PTR) __SOFTFP; sl@0: IMPORT_C long strtol (const char *_n, char **_end_PTR, int _base); sl@0: IMPORT_C unsigned long strtoul (const char *_n_PTR, char **_end_PTR, int _base); sl@0: IMPORT_C int system (const char *_string); sl@0: IMPORT_C int wsystem (const wchar_t *_string); sl@0: sl@0: /** sl@0: not STRICT ANSI, but available anyway... sl@0: */ sl@0: IMPORT_C int setenv (const char *_string, const char *_value, int _overwrite); sl@0: IMPORT_C void unsetenv (const char *_name); sl@0: IMPORT_C int wsetenv (const wchar_t *_string, const wchar_t *_value, int _overwrite); sl@0: IMPORT_C void wunsetenv (const wchar_t *_name); sl@0: sl@0: #ifndef _STRICT_ANSI sl@0: float strtodf (const char *_n, char **_end_PTR); sl@0: float atoff (const char *_nptr); sl@0: sl@0: void cfree (void *, void *); sl@0: int putenv (const char *_string); sl@0: sl@0: char * gcvt (double,int,char *); sl@0: char * gcvtf (float,int,char *); sl@0: char * fcvt (double,int,int *,int *); sl@0: char * fcvtf (float, int,int *,int *); sl@0: char * ecvt (double, int,int *,int *); sl@0: char * ecvtbuf (double, int, int*, int*, char *); sl@0: char * fcvtbuf (double, int, int*, int*, char *); sl@0: char * ecvtf (float, int,int *,int *); sl@0: char * dtoa (double, int, int, int *, int*, char**); sl@0: #endif /* ! _STRICT_ANSI */ sl@0: sl@0: /* FIX THIS: 4.10.7: Multibyte character functions are missing. */ sl@0: sl@0: #ifdef __cplusplus sl@0: } sl@0: #endif sl@0: #endif /* _STDLIB_H_ */