intl/icu/source/common/uinit.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/common/uinit.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +/*
     1.5 +******************************************************************************
     1.6 +* Copyright (C) 2001-2013, International Business Machines
     1.7 +*                Corporation and others. All Rights Reserved.
     1.8 +******************************************************************************
     1.9 +*   file name:  uinit.cpp
    1.10 +*   encoding:   US-ASCII
    1.11 +*   tab size:   8 (not used)
    1.12 +*   indentation:4
    1.13 +*
    1.14 +*   created on: 2001July05
    1.15 +*   created by: George Rhoten
    1.16 +*/
    1.17 +
    1.18 +#include "unicode/utypes.h"
    1.19 +#include "unicode/icuplug.h"
    1.20 +#include "unicode/uclean.h"
    1.21 +#include "cmemory.h"
    1.22 +#include "icuplugimp.h"
    1.23 +#include "ucln_cmn.h"
    1.24 +#include "ucnv_io.h"
    1.25 +#include "umutex.h"
    1.26 +#include "utracimp.h"
    1.27 +
    1.28 +U_NAMESPACE_BEGIN
    1.29 +
    1.30 +static UInitOnce gICUInitOnce = U_INITONCE_INITIALIZER;
    1.31 +
    1.32 +static UBool U_CALLCONV uinit_cleanup() {
    1.33 +    gICUInitOnce.reset();
    1.34 +    return TRUE;
    1.35 +}
    1.36 +
    1.37 +static void U_CALLCONV
    1.38 +initData(UErrorCode &status)
    1.39 +{
    1.40 +    /* initialize plugins */
    1.41 +    uplug_init(&status);
    1.42 +
    1.43 +#if !UCONFIG_NO_CONVERSION
    1.44 +    /*
    1.45 +     * 2005-may-02
    1.46 +     *
    1.47 +     * ICU4C 3.4 (jitterbug 4497) hardcodes the data for Unicode character
    1.48 +     * properties for APIs that want to be fast.
    1.49 +     * Therefore, we need not load them here nor check for errors.
    1.50 +     * Instead, we load the converter alias table to see if any ICU data
    1.51 +     * is available.
    1.52 +     * Users should really open the service objects they need and check
    1.53 +     * for errors there, to make sure that the actual items they need are
    1.54 +     * available.
    1.55 +     */
    1.56 +    ucnv_io_countKnownConverters(&status);
    1.57 +#endif
    1.58 +    ucln_common_registerCleanup(UCLN_COMMON_UINIT, uinit_cleanup);
    1.59 +}
    1.60 +
    1.61 +/*
    1.62 + * ICU Initialization Function. Need not be called.
    1.63 + */
    1.64 +U_CAPI void U_EXPORT2
    1.65 +u_init(UErrorCode *status) {
    1.66 +    UTRACE_ENTRY_OC(UTRACE_U_INIT);
    1.67 +    umtx_initOnce(gICUInitOnce, &initData, *status);
    1.68 +    UTRACE_EXIT_STATUS(*status);
    1.69 +}
    1.70 +
    1.71 +U_NAMESPACE_END

mercurial