|
1 /* |
|
2 ****************************************************************************** |
|
3 * Copyright (C) 2001-2013, International Business Machines |
|
4 * Corporation and others. All Rights Reserved. |
|
5 ****************************************************************************** |
|
6 * file name: uinit.cpp |
|
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" |
|
16 #include "unicode/icuplug.h" |
|
17 #include "unicode/uclean.h" |
|
18 #include "cmemory.h" |
|
19 #include "icuplugimp.h" |
|
20 #include "ucln_cmn.h" |
|
21 #include "ucnv_io.h" |
|
22 #include "umutex.h" |
|
23 #include "utracimp.h" |
|
24 |
|
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 |
|
34 static void U_CALLCONV |
|
35 initData(UErrorCode &status) |
|
36 { |
|
37 /* initialize plugins */ |
|
38 uplug_init(&status); |
|
39 |
|
40 #if !UCONFIG_NO_CONVERSION |
|
41 /* |
|
42 * 2005-may-02 |
|
43 * |
|
44 * ICU4C 3.4 (jitterbug 4497) hardcodes the data for Unicode character |
|
45 * properties for APIs that want to be fast. |
|
46 * Therefore, we need not load them here nor check for errors. |
|
47 * Instead, we load the converter alias table to see if any ICU data |
|
48 * is available. |
|
49 * Users should really open the service objects they need and check |
|
50 * for errors there, to make sure that the actual items they need are |
|
51 * available. |
|
52 */ |
|
53 ucnv_io_countKnownConverters(&status); |
|
54 #endif |
|
55 ucln_common_registerCleanup(UCLN_COMMON_UINIT, uinit_cleanup); |
|
56 } |
|
57 |
|
58 /* |
|
59 * ICU Initialization Function. Need not be called. |
|
60 */ |
|
61 U_CAPI void U_EXPORT2 |
|
62 u_init(UErrorCode *status) { |
|
63 UTRACE_ENTRY_OC(UTRACE_U_INIT); |
|
64 umtx_initOnce(gICUInitOnce, &initData, *status); |
|
65 UTRACE_EXIT_STATUS(*status); |
|
66 } |
|
67 |
|
68 U_NAMESPACE_END |