|
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 "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.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 @file |
|
24 @publishedAll |
|
25 @released |
|
26 */ |
|
27 |
|
28 |
|
29 #ifndef _STDLIB_H_ |
|
30 #ifdef __cplusplus |
|
31 extern "C" { |
|
32 #endif |
|
33 #define _STDLIB_H_ |
|
34 |
|
35 #include "libc/_ansi.h" |
|
36 |
|
37 #define __need_size_t |
|
38 #define __need_wchar_t |
|
39 #include <stddef.h> |
|
40 |
|
41 #include <sys/reent.h> |
|
42 |
|
43 typedef struct |
|
44 { |
|
45 int quot; /* quotient */ |
|
46 int rem; /* remainder */ |
|
47 } div_t; |
|
48 |
|
49 #define labs abs |
|
50 #define ldiv div |
|
51 #define ldiv_t div_t |
|
52 |
|
53 #ifndef NULL |
|
54 #define NULL 0L |
|
55 #endif |
|
56 |
|
57 #define EXIT_FAILURE 1 |
|
58 #define EXIT_SUCCESS 0 |
|
59 #define RAND_MAX 0x7fffffff |
|
60 #define MB_CUR_MAX 3 |
|
61 |
|
62 /** |
|
63 Workaround a built-in prototype in MSVC 5.0 |
|
64 */ |
|
65 #define atexit _epoc32_atexit |
|
66 IMPORT_C int _epoc32_atexit (void (*_func)(void)); |
|
67 |
|
68 #ifdef EKA2 |
|
69 void abort (void); |
|
70 #else |
|
71 IMPORT_C void abort (void); |
|
72 #endif |
|
73 |
|
74 IMPORT_C int abs (int); |
|
75 IMPORT_C double atof (const char *_nptr) __SOFTFP; |
|
76 IMPORT_C int atoi (const char *_nptr); |
|
77 |
|
78 #define atol atoi |
|
79 IMPORT_C void* bsearch (const void * _key, |
|
80 const void * _base, |
|
81 size_t _nmemb, |
|
82 size_t _size, |
|
83 int (*_compar)(const void *, const void *)); |
|
84 IMPORT_C void* calloc (size_t _nmemb, size_t _size); |
|
85 IMPORT_C div_t div (int _numer, int _denom); |
|
86 IMPORT_C void exit (int _status) _ATTRIBUTE((noreturn)); |
|
87 IMPORT_C void free (void *); |
|
88 IMPORT_C char* getenv (const char *_string); |
|
89 IMPORT_C wchar_t* wgetenv (const wchar_t *_string); |
|
90 IMPORT_C void* malloc (size_t _size); |
|
91 |
|
92 IMPORT_C int mbtowc (wchar_t *pwc, const char *s, size_t n); |
|
93 IMPORT_C int wctomb (char *s, wchar_t wc); |
|
94 IMPORT_C int mbstowcs (wchar_t *pwc, const char *s, size_t n); |
|
95 IMPORT_C int wcstombs (char *s, const wchar_t *pwc, size_t n); |
|
96 IMPORT_C int mblen (const char * string, size_t size); |
|
97 |
|
98 IMPORT_C void qsort (void * _base, size_t _nmemb, size_t _size, int(*_compar)(const void *, const void *)); |
|
99 IMPORT_C int rand (void); |
|
100 IMPORT_C void* realloc (void * _r, size_t _size); |
|
101 IMPORT_C void srand (unsigned _seed); |
|
102 IMPORT_C double strtod (const char *_n, char **_end_PTR) __SOFTFP; |
|
103 IMPORT_C long strtol (const char *_n, char **_end_PTR, int _base); |
|
104 IMPORT_C unsigned long strtoul (const char *_n_PTR, char **_end_PTR, int _base); |
|
105 IMPORT_C int system (const char *_string); |
|
106 IMPORT_C int wsystem (const wchar_t *_string); |
|
107 |
|
108 /** |
|
109 not STRICT ANSI, but available anyway... |
|
110 */ |
|
111 IMPORT_C int setenv (const char *_string, const char *_value, int _overwrite); |
|
112 IMPORT_C void unsetenv (const char *_name); |
|
113 IMPORT_C int wsetenv (const wchar_t *_string, const wchar_t *_value, int _overwrite); |
|
114 IMPORT_C void wunsetenv (const wchar_t *_name); |
|
115 |
|
116 #ifndef _STRICT_ANSI |
|
117 float strtodf (const char *_n, char **_end_PTR); |
|
118 float atoff (const char *_nptr); |
|
119 |
|
120 void cfree (void *, void *); |
|
121 int putenv (const char *_string); |
|
122 |
|
123 char * gcvt (double,int,char *); |
|
124 char * gcvtf (float,int,char *); |
|
125 char * fcvt (double,int,int *,int *); |
|
126 char * fcvtf (float, int,int *,int *); |
|
127 char * ecvt (double, int,int *,int *); |
|
128 char * ecvtbuf (double, int, int*, int*, char *); |
|
129 char * fcvtbuf (double, int, int*, int*, char *); |
|
130 char * ecvtf (float, int,int *,int *); |
|
131 char * dtoa (double, int, int, int *, int*, char**); |
|
132 #endif /* ! _STRICT_ANSI */ |
|
133 |
|
134 /* FIX THIS: 4.10.7: Multibyte character functions are missing. */ |
|
135 |
|
136 #ifdef __cplusplus |
|
137 } |
|
138 #endif |
|
139 #endif /* _STDLIB_H_ */ |