michael@0: /* michael@0: ****************************************************************************** michael@0: * Copyright (C) 2001-2013, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ****************************************************************************** michael@0: * file name: uinit.cpp michael@0: * encoding: US-ASCII michael@0: * tab size: 8 (not used) michael@0: * indentation:4 michael@0: * michael@0: * created on: 2001July05 michael@0: * created by: George Rhoten michael@0: */ michael@0: michael@0: #include "unicode/utypes.h" michael@0: #include "unicode/icuplug.h" michael@0: #include "unicode/uclean.h" michael@0: #include "cmemory.h" michael@0: #include "icuplugimp.h" michael@0: #include "ucln_cmn.h" michael@0: #include "ucnv_io.h" michael@0: #include "umutex.h" michael@0: #include "utracimp.h" michael@0: michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: static UInitOnce gICUInitOnce = U_INITONCE_INITIALIZER; michael@0: michael@0: static UBool U_CALLCONV uinit_cleanup() { michael@0: gICUInitOnce.reset(); michael@0: return TRUE; michael@0: } michael@0: michael@0: static void U_CALLCONV michael@0: initData(UErrorCode &status) michael@0: { michael@0: /* initialize plugins */ michael@0: uplug_init(&status); michael@0: michael@0: #if !UCONFIG_NO_CONVERSION michael@0: /* michael@0: * 2005-may-02 michael@0: * michael@0: * ICU4C 3.4 (jitterbug 4497) hardcodes the data for Unicode character michael@0: * properties for APIs that want to be fast. michael@0: * Therefore, we need not load them here nor check for errors. michael@0: * Instead, we load the converter alias table to see if any ICU data michael@0: * is available. michael@0: * Users should really open the service objects they need and check michael@0: * for errors there, to make sure that the actual items they need are michael@0: * available. michael@0: */ michael@0: ucnv_io_countKnownConverters(&status); michael@0: #endif michael@0: ucln_common_registerCleanup(UCLN_COMMON_UINIT, uinit_cleanup); michael@0: } michael@0: michael@0: /* michael@0: * ICU Initialization Function. Need not be called. michael@0: */ michael@0: U_CAPI void U_EXPORT2 michael@0: u_init(UErrorCode *status) { michael@0: UTRACE_ENTRY_OC(UTRACE_U_INIT); michael@0: umtx_initOnce(gICUInitOnce, &initData, *status); michael@0: UTRACE_EXIT_STATUS(*status); michael@0: } michael@0: michael@0: U_NAMESPACE_END