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