williamr@2: /* williamr@2: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * 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 williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * WARNING: All identifiers here must begin with an underscore. This file is williamr@2: * included by stdio.h and others and we therefore must only use identifiers williamr@2: * in the namespace allotted to us. williamr@2: * williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @file williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: williamr@2: #ifndef _SYS_REENT_H_ williamr@2: #ifdef __cplusplus williamr@2: extern "C" { williamr@2: #endif williamr@2: williamr@2: #define _SYS_REENT_H_ williamr@2: williamr@2: #include <_ansi.h> williamr@2: #include /* _sFILE type */ williamr@2: #include /* for struct tm */ williamr@2: williamr@2: struct _glue williamr@2: { williamr@2: struct _glue *_next; williamr@2: int _niobs; williamr@2: struct __sFILE *_iobs; williamr@2: }; williamr@2: williamr@2: /** williamr@2: atexit() support williamr@2: */ williamr@2: #define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */ williamr@2: williamr@2: struct _atexit { williamr@2: struct _atexit *_next; /* next in list */ williamr@2: int _ind; /* next index in this table */ williamr@2: void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */ williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: struct _reent williamr@2: williamr@2: This structure contains *all* globals needed by the library. williamr@2: It's raison d'etre is to facilitate threads by making all library routines williamr@2: reentrant. IE: All state information is contained here. williamr@2: */ williamr@2: williamr@2: #define _ASCTIME_SIZE (26+8) /* 26 min, plus caution factor! */ williamr@2: #define _MINNARROWBUFSIZE 100 williamr@2: williamr@2: #ifdef __MWERKS__ williamr@2: #pragma warn_padding off williamr@2: #endif williamr@2: williamr@2: struct _reent williamr@2: { williamr@2: /* local copy of errno */ williamr@2: int _errno; williamr@2: struct __sFILE _sf[3]; /* first three file descriptors: stdin, stdout, stderr */ williamr@2: williamr@2: char *_scanpoint; /* used by strtok */ williamr@2: char _asctime[_ASCTIME_SIZE]; /* used by asctime */ williamr@2: struct tm _struct_tm; /* used by gmtime */ williamr@2: long _next[2]; /* used by rand/srand (64-bit seed for EPOC32) */ williamr@2: int _inc; /* used by tmpnam */ williamr@2: char _tmpnam[37]; /* used by tmpnam & inet_ntoa */ williamr@2: wchar_t _wtmpnam[37]; /* used by tmpnam & inet_ntoa */ williamr@2: void *_netdb; /* used by gethostbyaddr and similar netdb functions */ williamr@2: williamr@2: int _current_category; /* used by setlocale */ williamr@2: const char *_current_locale; williamr@2: williamr@2: int __sdidinit; /* 1 means stdio has been init'd */ williamr@2: williamr@2: void (*__cleanup)(struct _reent *); williamr@2: williamr@2: /* atexit stuff */ williamr@2: struct _atexit *_atexit; /* points to head of LIFO stack */ williamr@2: struct _atexit _atexit0; /* one guaranteed table, required by ANSI */ williamr@2: williamr@2: /* signal info */ williamr@2: void (**(_sig_func))(); williamr@2: williamr@2: struct _glue __sglue; /* root of glue chain for additional sFILE structures */ williamr@2: williamr@2: char **environ; williamr@2: int environ_slots; williamr@2: williamr@2: char* _pNarrowEnvBuffer; williamr@2: int _NEBSize; williamr@2: williamr@2: void *_system; /* Pointer to a C++ POSIX System object - Hands off! */ williamr@2: }; williamr@2: williamr@2: /** williamr@2: The struct _reent is managed on a per-thread basis by EPOC32, so there is no global williamr@2: variable _impure_pointer and everyone has to use _REENT (panics in the event of an williamr@2: error) or REENT2 (which returns a NULL pointer in the event of an error). williamr@2: */ williamr@2: IMPORT_C void _reclaim_reent (struct _reent*); williamr@2: IMPORT_C void _REENT_INIT (struct _reent*); williamr@2: IMPORT_C struct _reent* ImpurePtr (void); williamr@2: IMPORT_C struct _reent* ImpurePtr2 (void); williamr@2: IMPORT_C void _init_reent (struct _reent*,void*); williamr@2: williamr@2: /** williamr@2: Support for explicit release of all STDLIB resources belonging to this thread williamr@2: */ williamr@2: IMPORT_C void CloseSTDLIB(); williamr@2: williamr@2: #define _REENT (ImpurePtr()) williamr@2: #define _REENT2 (ImpurePtr2()) williamr@2: #define __errno_r(ptr) ((ptr)->_errno) williamr@2: williamr@2: #ifdef __cplusplus williamr@2: } williamr@2: #endif williamr@2: williamr@2: #endif /* _SYS_REENT_H_ */