2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * WARNING: All identifiers here must begin with an underscore. This file is
16 * included by stdio.h and others and we therefore must only use identifiers
17 * in the namespace allotted to us.
38 #include <sys/stdio_t.h> /* _sFILE type */
39 #include <time.h> /* for struct tm */
45 struct __sFILE *_iobs;
51 #define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */
54 struct _atexit *_next; /* next in list */
55 int _ind; /* next index in this table */
56 void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
63 This structure contains *all* globals needed by the library.
64 It's raison d'etre is to facilitate threads by making all library routines
65 reentrant. IE: All state information is contained here.
68 #define _ASCTIME_SIZE (26+8) /* 26 min, plus caution factor! */
69 #define _MINNARROWBUFSIZE 100
72 #pragma warn_padding off
77 /* local copy of errno */
79 struct __sFILE _sf[3]; /* first three file descriptors: stdin, stdout, stderr */
81 char *_scanpoint; /* used by strtok */
82 char _asctime[_ASCTIME_SIZE]; /* used by asctime */
83 struct tm _struct_tm; /* used by gmtime */
84 long _next[2]; /* used by rand/srand (64-bit seed for EPOC32) */
85 int _inc; /* used by tmpnam */
86 char _tmpnam[37]; /* used by tmpnam & inet_ntoa */
87 wchar_t _wtmpnam[37]; /* used by tmpnam & inet_ntoa */
88 void *_netdb; /* used by gethostbyaddr and similar netdb functions */
90 int _current_category; /* used by setlocale */
91 const char *_current_locale;
93 int __sdidinit; /* 1 means stdio has been init'd */
95 void (*__cleanup)(struct _reent *);
98 struct _atexit *_atexit; /* points to head of LIFO stack */
99 struct _atexit _atexit0; /* one guaranteed table, required by ANSI */
102 void (**(_sig_func))();
104 struct _glue __sglue; /* root of glue chain for additional sFILE structures */
109 char* _pNarrowEnvBuffer;
112 void *_system; /* Pointer to a C++ POSIX System object - Hands off! */
116 The struct _reent is managed on a per-thread basis by EPOC32, so there is no global
117 variable _impure_pointer and everyone has to use _REENT (panics in the event of an
118 error) or REENT2 (which returns a NULL pointer in the event of an error).
120 IMPORT_C void _reclaim_reent (struct _reent*);
121 IMPORT_C void _REENT_INIT (struct _reent*);
122 IMPORT_C struct _reent* ImpurePtr (void);
123 IMPORT_C struct _reent* ImpurePtr2 (void);
124 IMPORT_C void _init_reent (struct _reent*,void*);
127 Support for explicit release of all STDLIB resources belonging to this thread
129 IMPORT_C void CloseSTDLIB();
131 #define _REENT (ImpurePtr())
132 #define _REENT2 (ImpurePtr2())
133 #define __errno_r(ptr) ((ptr)->_errno)
139 #endif /* _SYS_REENT_H_ */