xml/libxml2libs/src/libxml2/xmlenglibxml2dll.cpp
changeset 0 e35f40988205
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Utils for XML Engine
       
    15 //
       
    16 
       
    17 #define IN_LIBXML
       
    18 #include <stdlib.h>
       
    19 #include <string.h>
       
    20 #include "libxml2_globals_private.h"
       
    21 #include <e32std.h>
       
    22 
       
    23 /**
       
    24 Return address at the limit of the system stack.
       
    25 
       
    26 When this address is reached, stack overflow occurs.
       
    27 */
       
    28 unsigned int xeStackLimitAddress()
       
    29     {
       
    30     TThreadStackInfo aInfo;
       
    31     RThread().StackInfo(aInfo);
       
    32     return (unsigned int) aInfo.iLimit;
       
    33     }
       
    34 
       
    35 /**
       
    36 Retrieves a pointer to the 'global state' structure that contains all global settings
       
    37 
       
    38 Initialization of global data is performed when first user of XML Engine calls
       
    39 XmlEngine::XmlEngineAttachL() or XmlEngine::XmlEnginePushL()
       
    40 */
       
    41 XMLPUBFUNEXPORT xmlGlobalStatePtr xmlGetGlobalState(void)
       
    42     {
       
    43     // DONE: Move code that initializes global data into XmlEngine::XmlEngineAttachL()
       
    44     xmlGlobalStatePtr gs = STATIC_CAST(xmlGlobalStatePtr, Dll::Tls());
       
    45     
       
    46     return gs;
       
    47     }
       
    48 
       
    49 /**
       
    50 Sets value of tread-local storage.
       
    51 */
       
    52 void xeSetTLS(void* aPtr)
       
    53     {
       
    54     Dll::SetTls(aPtr);
       
    55     }
       
    56 
       
    57 /**
       
    58 Returns pointer to the global state structure as it is stored in TLS.
       
    59 
       
    60 Use only xeGetTLS() for checking the content of libxml2's TLS, otherwise
       
    61 Dll:Tls() returns value, which is specific to the caller's DLL and thread, not libxml2's!
       
    62 */
       
    63 XMLPUBFUNEXPORT xmlGlobalStatePtr xeGetTLS()
       
    64     {
       
    65     return STATIC_CAST(xmlGlobalStatePtr, Dll::Tls());
       
    66     }