]> git.saurik.com Git - apple/icu.git/blob - icuSources/common/uinit.c
ICU-491.11.2.tar.gz
[apple/icu.git] / icuSources / common / uinit.c
1 /*
2 ******************************************************************************
3 * *
4 * Copyright (C) 2001-2011, International Business Machines *
5 * Corporation and others. All Rights Reserved. *
6 * *
7 ******************************************************************************
8 * file name: uinit.c
9 * encoding: US-ASCII
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"
18 #include "unicode/icuplug.h"
19 #include "unicode/uclean.h"
20 #include "cmemory.h"
21 #include "icuplugimp.h"
22 #include "ucln.h"
23 #include "ucnv_io.h"
24 #include "umutex.h"
25 #include "utracimp.h"
26
27 /*
28 * ICU Initialization Function. Need not be called.
29 */
30 U_CAPI void U_EXPORT2
31 u_init(UErrorCode *status) {
32 UTRACE_ENTRY_OC(UTRACE_U_INIT);
33 /* initialize plugins */
34 uplug_init(status);
35
36 umtx_lock(&gICUInitMutex);
37 if (gICUInitialized || U_FAILURE(*status)) {
38 umtx_unlock(&gICUInitMutex);
39 UTRACE_EXIT_STATUS(*status);
40 return;
41 }
42
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 */
55 #if !UCONFIG_NO_CONVERSION
56 ucnv_io_countKnownConverters(status);
57 #endif
58
59 gICUInitialized = TRUE; /* TODO: don't set if U_FAILURE? */
60 umtx_unlock(&gICUInitMutex);
61 UTRACE_EXIT_STATUS(*status);
62 }