sl@0: /* sl@0: * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Name : libcppwsd.h sl@0: * Part of : standard c++ library (wsd definitions) sl@0: * sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #ifndef LIBSTDCPPWSD_H_ sl@0: #define LIBSTDCPPWSD_H_ sl@0: sl@0: #ifdef __SYMBIAN32__WSD__ //stuff for WSD sl@0: sl@0: sl@0: // ****************************** WSD RELATED ************************// sl@0: #include sl@0: #include // For emulator WSD API sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: // Global hash tables for category objects. sl@0: typedef std::hash_map, std::hash, std::equal_to > Category_Map; sl@0: sl@0: #define LOCALE_ID_MAX 39 sl@0: /* sl@0: * The following functions are used to make allocations internal to the sl@0: * C++ library.These are only required on the emulator as these are sl@0: * static variables in the actual STLPort implementation but in order to sl@0: * save them on the ewsd, they need to allocated on heap. sl@0: */ sl@0: IMPORT_C void* WSDAlloc(unsigned int size); sl@0: IMPORT_C int WSDFree(void*); sl@0: sl@0: // ******************************************************// sl@0: // *** all WSD definitions here sl@0: // ******************************************************// sl@0: class _Libcpp_wsd sl@0: { sl@0: public: sl@0: //_locale.h sl@0: size_t locale_id_S_max; sl@0: sl@0: //locale_impl.h sl@0: std::locale *_Stl_classic_locale; sl@0: std::locale *_Stl_global_locale; sl@0: sl@0: void* __Loc_init_buf; sl@0: sl@0: std::_Refcount_Base *_Loc_init_S_count; sl@0: sl@0: //locale.cpp sl@0: __stl_atomic_t _S_index; sl@0: std::_STLP_STATIC_MUTEX locale_Index_lock; sl@0: sl@0: //_ios_base.h sl@0: bool ios_base_S_was_synced; sl@0: long ios_base_Init_S_count; //ios_base::Init class sl@0: std::ios_base::Init *_IosInit; sl@0: sl@0: //ios.cpp sl@0: int ios_base_xalloc_S_index; sl@0: std::_STLP_STATIC_MUTEX ios_base_xalloc_lock; sl@0: sl@0: //locale_catalog.cpp sl@0: Category_Map *_S_ctype_hash; sl@0: Category_Map *_S_numeric_hash; sl@0: Category_Map *_S_time_hash; sl@0: Category_Map *_S_collate_hash; sl@0: Category_Map *_S_monetary_hash; sl@0: Category_Map *_S_messages_hash; sl@0: sl@0: std::_STLP_STATIC_MUTEX locale_catalog_category_hash_lock; sl@0: sl@0: //iostream.cpp sl@0: std::istream *wsd_cin; sl@0: std::ostream *wsd_cout; sl@0: std::ostream *wsd_cerr; sl@0: std::ostream *wsd_clog; sl@0: #ifndef _STLP_NO_WCHAR_T sl@0: std::wistream *wsd_wcin; sl@0: std::wostream *wsd_wcout; sl@0: std::wostream *wsd_wcerr; sl@0: std::wostream *wsd_wclog; sl@0: #endif sl@0: sl@0: //numpunct.cpp sl@0: std::string numpunct_char_m_truename; sl@0: std::string numpunct_char_m_falsename; sl@0: std::string numpunct_char_m_grouping; sl@0: # ifndef _STLP_NO_WCHAR_T sl@0: std::wstring numpunct_wchar_m_truename; sl@0: std::wstring numpunct_wchar_m_falsename; sl@0: std::string numpunct_wchar_m_grouping; sl@0: # endif sl@0: sl@0: //monetary.cpp sl@0: std::string monetary_S_empty_string; sl@0: # ifndef _STLP_NO_WCHAR_T sl@0: std::wstring monetary_S_empty_wstring; sl@0: # endif //_STLP_NO_WCHAR_T sl@0: sl@0: //_fstream.h sl@0: size_t fstream_Filebuf_base_M_page_size; sl@0: sl@0: //allocators.cpp sl@0: std::__oom_handler_type wsd__oom_handler; sl@0: std::_STLP_STATIC_MUTEX wsd_allocator_S_lock; sl@0: size_t wsd__node_alloc_impl_S_heap_size; sl@0: char* wsd_S_start_free; sl@0: char* wsd_S_end_free; sl@0: void* wsd_S_free_list[16]; sl@0: sl@0: std::_STLP_STATIC_MUTEX wsd_pt_S_chunk_allocator_lock; sl@0: char *wsd_pt_S_start_free; sl@0: char *wsd_pt_S_end_free; sl@0: size_t wsd_pt_S_heap_size; sl@0: stlp_priv::_Pthread_alloc::__state_type *wsd_pt_S_free_per_thread_states; sl@0: pthread_key_t wsd_pt_S_key; sl@0: bool wsd_pt_S_key_initialized; sl@0: sl@0: //_threads.h sl@0: std::_STLP_STATIC_MUTEX _threads_S_swap_lock; sl@0: std::_STLP_STATIC_MUTEX _threads_0_S_swap_lock; sl@0: unsigned _mutex_max; sl@0: unsigned _mutex_last; sl@0: sl@0: # ifndef _STLP_NO_MBSTATE_T sl@0: std::locale::id codecvt_char_char_mbstate_id; sl@0: # ifndef _STLP_NO_WCHAR_T sl@0: std::locale::id codecvt_wchar_char_mbstate_id; sl@0: # endif sl@0: # endif //_STLP_NO_MBSTATE_T sl@0: std::locale::id collate_char_id; sl@0: sl@0: std::locale::id ctype_char_id; sl@0: sl@0: std::locale::id moneypunct_char_true_id; sl@0: sl@0: std::locale::id moneypunct_char_false_id; sl@0: sl@0: std::locale::id messages_char_id; sl@0: sl@0: std::locale::id numpunct_char_id; sl@0: sl@0: # ifndef _STLP_NO_WCHAR_T sl@0: std::locale::id collate_wchar_id; sl@0: sl@0: std::locale::id ctype_wchar_id; sl@0: sl@0: std::locale::id moneypunct_wchar_true_id; sl@0: sl@0: std::locale::id moneypunct_wchar_false_id; sl@0: sl@0: std::locale::id numpunct_wchar_id; sl@0: sl@0: std::locale::id messages_wchar_id; sl@0: sl@0: std::locale::id num_get_wchar_istreambuf_iterator_id; sl@0: sl@0: std::locale::id num_get_wchar_wchar_const_id; sl@0: sl@0: std::locale::id num_put_wchar_ostreambuf_iterator_id; sl@0: sl@0: std::locale::id num_put_wchar_wchar_id; sl@0: sl@0: std::locale::id time_get_wchar_istreambuf_iterator_id; sl@0: sl@0: std::locale::id time_get_wchar_wchar_const_id; sl@0: sl@0: std::locale::id time_put_wchar_ostreambuf_iterator_id; sl@0: sl@0: std::locale::id time_put_wchar_wchar_id; sl@0: sl@0: std::locale::id money_get_wchar_istreambuf_iterator_id; sl@0: sl@0: std::locale::id money_get_wchar_wchar_const_id; sl@0: sl@0: std::locale::id money_put_wchar_ostreambuf_iterator_id; sl@0: sl@0: std::locale::id money_put_wchar_wchar_id; sl@0: #endif sl@0: sl@0: std::locale::id time_get_char_istreambuf_iterator_id; sl@0: sl@0: std::locale::id time_get_char_char_const_id; sl@0: sl@0: std::locale::id time_put_char_ostreambuf_iterator_id; sl@0: sl@0: std::locale::id time_put_char_char_id; sl@0: sl@0: std::locale::id num_get_char_istreambuf_iterator_id; sl@0: sl@0: std::locale::id num_get_char_char_const_id; sl@0: sl@0: std::locale::id num_put_char_ostreambuf_iterator_id; sl@0: sl@0: std::locale::id num_put_char_char_id; sl@0: sl@0: std::locale::id num_put_char_back_insert_iterator_id; sl@0: sl@0: std::locale::id money_get_char_istreambuf_iterator_id; sl@0: sl@0: std::locale::id money_get_char_char_const_id; sl@0: sl@0: std::locale::id money_put_char_ostreambuf_iterator_id; sl@0: sl@0: std::locale::id money_put_char_char_id; sl@0: sl@0: std::map ctype_charT_ids; //for ctype sl@0: std::map numpunct_charT_ids; //for numpunct sl@0: std::map moneypunct_charT_ids; //for moneypunct sl@0: sl@0: #ifdef _STLP_DEBUG sl@0: std::string *_Nameless; sl@0: #endif sl@0: // ****** end of static var definition sl@0: sl@0: bool is_Initialized; sl@0: sl@0: //constructor sl@0: _Libcpp_wsd(); sl@0: sl@0: //destructor sl@0: ~_Libcpp_wsd(); sl@0: sl@0: }; sl@0: sl@0: sl@0: //declaraions for wsd initialization functions sl@0: void locale_impl_init(); sl@0: void locale_index_lock_init(); sl@0: void monetary_empty_string_init(); sl@0: void global_iostream_init(); sl@0: void stdcpp_allocators_init(); sl@0: void filebuf_page_size_init(); sl@0: sl@0: #ifdef _STLP_DEBUG sl@0: inline std::string*& get_Nameless(); sl@0: #endif sl@0: sl@0: namespace _STLP_PRIV_NAME { sl@0: void locale_catalog_category_hash_lock_init(); sl@0: void Category_Map_Init(); sl@0: _STLP_END_NAMESPACE sl@0: sl@0: sl@0: const TUid KLibstdcppUID = {0x20017610}; sl@0: sl@0: //cleanup all the WSD allocations sl@0: IMPORT_C void CleanupWSD(); sl@0: sl@0: //return the global class pointer sl@0: IMPORT_C _Libcpp_wsd& get_libcpp_wsd(); sl@0: sl@0: #ifdef _STLP_DEBUG sl@0: inline std::string*& get_Nameless() sl@0: { sl@0: return get_libcpp_wsd()._Nameless; sl@0: } sl@0: #endif sl@0: sl@0: sl@0: // ******************************************************// sl@0: sl@0: //locale wsd functions sl@0: #include "wsd_locales.h" sl@0: sl@0: //streams wsd functions sl@0: #include "wsd_streams.h" sl@0: sl@0: // ******************************************************// sl@0: #endif sl@0: sl@0: #endif /*LIBSTDCPPWSD_H_*/