]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
374ca955 A |
3 | /* |
4 | ****************************************************************************** | |
2ca993e8 | 5 | * Copyright (C) 2001-2015, International Business Machines |
57a6839d | 6 | * Corporation and others. All Rights Reserved. |
374ca955 | 7 | ****************************************************************************** |
57a6839d | 8 | * file name: uinit.cpp |
f3c0d7a5 | 9 | * encoding: UTF-8 |
374ca955 A |
10 | * tab size: 8 (not used) |
11 | * indentation:4 | |
12 | * | |
13 | * created on: 2001July05 | |
14 | * created by: George Rhoten | |
15 | */ | |
16 | ||
17 | #include "unicode/utypes.h" | |
729e4ab9 | 18 | #include "unicode/icuplug.h" |
374ca955 | 19 | #include "unicode/uclean.h" |
729e4ab9 A |
20 | #include "cmemory.h" |
21 | #include "icuplugimp.h" | |
57a6839d | 22 | #include "ucln_cmn.h" |
73c04bcf | 23 | #include "ucnv_io.h" |
57a6839d | 24 | #include "umutex.h" |
729e4ab9 | 25 | #include "utracimp.h" |
374ca955 | 26 | |
57a6839d A |
27 | U_NAMESPACE_BEGIN |
28 | ||
29 | static UInitOnce gICUInitOnce = U_INITONCE_INITIALIZER; | |
30 | ||
31 | static UBool U_CALLCONV uinit_cleanup() { | |
32 | gICUInitOnce.reset(); | |
33 | return TRUE; | |
34 | } | |
35 | ||
51004dcb | 36 | static void U_CALLCONV |
57a6839d | 37 | initData(UErrorCode &status) |
51004dcb | 38 | { |
2ca993e8 | 39 | #if UCONFIG_ENABLE_PLUGINS |
57a6839d A |
40 | /* initialize plugins */ |
41 | uplug_init(&status); | |
2ca993e8 | 42 | #endif |
57a6839d A |
43 | |
44 | #if !UCONFIG_NO_CONVERSION | |
73c04bcf A |
45 | /* |
46 | * 2005-may-02 | |
47 | * | |
48 | * ICU4C 3.4 (jitterbug 4497) hardcodes the data for Unicode character | |
49 | * properties for APIs that want to be fast. | |
50 | * Therefore, we need not load them here nor check for errors. | |
51 | * Instead, we load the converter alias table to see if any ICU data | |
52 | * is available. | |
53 | * Users should really open the service objects they need and check | |
54 | * for errors there, to make sure that the actual items they need are | |
55 | * available. | |
56 | */ | |
57a6839d | 57 | ucnv_io_countKnownConverters(&status); |
73c04bcf | 58 | #endif |
57a6839d | 59 | ucln_common_registerCleanup(UCLN_COMMON_UINIT, uinit_cleanup); |
51004dcb A |
60 | } |
61 | ||
57a6839d A |
62 | U_NAMESPACE_END |
63 | ||
64 | U_NAMESPACE_USE | |
65 | ||
51004dcb A |
66 | /* |
67 | * ICU Initialization Function. Need not be called. | |
68 | */ | |
69 | U_CAPI void U_EXPORT2 | |
70 | u_init(UErrorCode *status) { | |
71 | UTRACE_ENTRY_OC(UTRACE_U_INIT); | |
57a6839d | 72 | umtx_initOnce(gICUInitOnce, &initData, *status); |
374ca955 A |
73 | UTRACE_EXIT_STATUS(*status); |
74 | } |