sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* Extension of <stdlib.h> with reentrant functions.
|
sl@0
|
16 |
*
|
sl@0
|
17 |
*
|
sl@0
|
18 |
*/
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
|
sl@0
|
22 |
/**
|
sl@0
|
23 |
@file
|
sl@0
|
24 |
@publishedAll
|
sl@0
|
25 |
@released
|
sl@0
|
26 |
*/
|
sl@0
|
27 |
|
sl@0
|
28 |
|
sl@0
|
29 |
#ifndef _STDLIB_R_H_
|
sl@0
|
30 |
#define _STDLIB_R_H_
|
sl@0
|
31 |
|
sl@0
|
32 |
#ifdef __cplusplus
|
sl@0
|
33 |
extern "C" {
|
sl@0
|
34 |
#endif
|
sl@0
|
35 |
|
sl@0
|
36 |
#include <stdlib.h>
|
sl@0
|
37 |
#include <sys/reent.h>
|
sl@0
|
38 |
|
sl@0
|
39 |
/**
|
sl@0
|
40 |
EPOC32 malloc uses the thread heap, so it is already thread-safe
|
sl@0
|
41 |
and no _malloc_r variants are needed.
|
sl@0
|
42 |
*/
|
sl@0
|
43 |
#define _malloc_r(x,n) malloc(n)
|
sl@0
|
44 |
#define _calloc_r(x,n,m) calloc(n,m)
|
sl@0
|
45 |
#define _realloc_r(x,p,n) realloc(p,n)
|
sl@0
|
46 |
#define _free_r(x,p) free(p)
|
sl@0
|
47 |
|
sl@0
|
48 |
IMPORT_C char* _dtoa_r (struct _reent *, double, int, int, int *, int*, char**);
|
sl@0
|
49 |
IMPORT_C void _mstats_r (struct _reent *, char *);
|
sl@0
|
50 |
IMPORT_C int _system_r (struct _reent *, const char *);
|
sl@0
|
51 |
IMPORT_C int _wsystem_r (struct _reent *, const wchar_t *);
|
sl@0
|
52 |
IMPORT_C int _rand_r (struct _reent *);
|
sl@0
|
53 |
IMPORT_C void _srand_r (struct _reent *, unsigned);
|
sl@0
|
54 |
IMPORT_C int _setenv_r (struct _reent *, const char *, const char *, int);
|
sl@0
|
55 |
IMPORT_C void _unsetenv_r (struct _reent *, const char *);
|
sl@0
|
56 |
IMPORT_C char* _getenv_r (struct _reent *, const char *);
|
sl@0
|
57 |
IMPORT_C int _wsetenv_r (struct _reent *, const wchar_t *, const wchar_t *, int);
|
sl@0
|
58 |
IMPORT_C void _wunsetenv_r (struct _reent *, const wchar_t *);
|
sl@0
|
59 |
IMPORT_C wchar_t* _wgetenv_r (struct _reent *, const wchar_t *);
|
sl@0
|
60 |
IMPORT_C unsigned long _strtoul_r(struct _reent *,const char *, char **, int);
|
sl@0
|
61 |
|
sl@0
|
62 |
/**
|
sl@0
|
63 |
It's possible to override exit() by supplying abort(), exit() and _exit()
|
sl@0
|
64 |
The generic exit() and abort() routines look like
|
sl@0
|
65 |
|
sl@0
|
66 |
void exit(int code) _ATTRIBUTE((noreturn))
|
sl@0
|
67 |
{
|
sl@0
|
68 |
_atexit_processing_r(_REENT);
|
sl@0
|
69 |
_exit(code);
|
sl@0
|
70 |
}
|
sl@0
|
71 |
void abort(void) _ATTRIBUTE((noreturn))
|
sl@0
|
72 |
{
|
sl@0
|
73 |
_exit(1);
|
sl@0
|
74 |
}
|
sl@0
|
75 |
|
sl@0
|
76 |
which then allows your _exit() to capture all exits from ESTLIB,
|
sl@0
|
77 |
except for __assert() which calls abort().
|
sl@0
|
78 |
*/
|
sl@0
|
79 |
IMPORT_C void _atexit_processing_r (struct _reent *);
|
sl@0
|
80 |
|
sl@0
|
81 |
#ifdef __cplusplus
|
sl@0
|
82 |
}
|
sl@0
|
83 |
#endif
|
sl@0
|
84 |
#endif /* _STDLIB_R_H_ */
|